Portable imaging device with multi-core processor and orientation sensor

ABSTRACT

A portable imaging device that has a CMOS image sensor, a color display for displaying an image sensed by the CMOS image sensor, an orientation sensor for sensing the device orientation and, a central processor. The central processor has an image sensor interface for receiving data from the CMOS image sensor and an output from the orientation sensor, multiple processing units configured for simultaneously processing the data, and an image display interface for sending processed data to the color display. The central processor is integrated onto a single chip.

CROSS REFERENCE TO RELATED APPLICATION

The present application is a Continuation of U.S. application Ser. No.13/104,021 filed May 10, 2011, which is a Continuation of U.S.application Ser. No. 12/758,730 filed Apr. 12, 2010, issued Jun. 14,2011 as U.S. Pat. No. 7,961,249, which is a continuation of U.S.application Ser. No. 11/045,442 filed Jan. 31, 2005, issued Apr. 20,2010 as U.S. Pat. No. 7,701,506, which is a continuation of U.S.application Ser. No. 09/112,786 filed on Jul. 10, 1998, issued Apr. 12,2005 as U.S. Pat. No. 6,879,341. Each of the above identified patentsand applications is hereby incorporated herein by reference in itsentirety.

FIELD OF THE INVENTION

The present invention relates to digital image processing and inparticular discloses Camera System Containing a VLIW Vector Processor.

Further the present invention relates to an image processing method andapparatus and, in particular, discloses a Digital Instant Camera withImage Processing Capability.

The present invention further relates to the field of digital cameratechnology and, particularly, discloses a digital camera having anintegral color printer.

BACKGROUND OF THE INVENTION

Traditional camera technology has for many years relied upon theprovision of an optical processing system which relies on a negative ofan image which is projected onto a photosensitive film which issubsequently chemically processed so as to “fix” the film and to allowfor positive prints to be produced which reproduce the original image.Such an image processing technology, although it has become a standard,can be unduly complex, as expensive and difficult technologies areinvolved in full color processing of images. Recently, digital camerashave become available. These cameras normally rely upon the utilizationof a charged coupled device (CCD) to sense a particular image. Thecamera normally includes storage media for the storage of the sensedscenes in addition to a connector for the transfer of images to acomputer device for subsequent manipulation and printing out.

Such devices are generally inconvenient in that all images must bestored by the camera and printed out at some later stage. Hence, thecamera must have sufficient storage capabilities for the storing ofmultiple images and, additionally, the user of the camera must haveaccess to a subsequent computer system for the downloading of the imagesand printing out by a computer printer or the like.

Further, digital camera devices have only limited on board processingcapabilities which can only perform limited manipulation of sensedimage. The main function of the on board processing capability is tostore the sensed image. As it may be desirable to carry out extensivemodification of an image, the capabilities of such digital cameradevices are considered inadequate.

SUMMARY OF THE INVENTION

The present invention relates to the provision of a digital camerasystem having significant on-board computational capabilities for themanipulation of images.

In accordance with a first aspect of the present invention, there isprovided a digital camera system comprising a sensing means for sensingan image; modification means for modifying the sensed image inaccordance with modification instructions input into the camera; and anoutput means for outputting the modified image; wherein the modificationmeans includes a series of processing elements arranged around a centralcrossbar switch. Preferably, the processing elements include anArithmetic Logic Unit (ALU) acting under the control of a microcodestore wherein the microcode store comprises a writeable control store.The processing elements can include an internal input and output FIFOfor storing pixel data utilized by the processing elements and themodification means is interconnected to a read and write FIFO forreading and writing pixel data of images to the modification means.

Each of the processing elements can be arranged in a ring and eachelement is also separately connected to its nearest neighbours. The ALUaccepts a series of inputs interconnected via an internal crossbarswitch to a series of core processing units within the ALU and includesa number of internal registers for the storage of temporary data. Thecore processing units can include at least one of a multiplier, an adderand a barrel shifter.

The processing elements are further connected to a common data bus forthe transfer of pixel data to the processing elements and the data busis interconnected to a data cache which acts as an intermediate cachebetween the processing elements and a memory store for storing theimages.

BRIEF DESCRIPTION OF THE DRAWINGS

Notwithstanding any other forms that may fall within the scope of thepresent invention, preferred forms of the invention will now bedescribed, by way of example only, with reference to the accompanyingdrawings in which:

FIG. 1 illustrates an Artcam device constructed in accordance with thepreferred embodiment;

FIG. 2 is a schematic block diagram of the main Artcam electroniccomponents;

FIG. 2A is a schematic block diagram of the main Artcam components,including an array of capacitive sensors for actuation by an actuatingformation on a printing cartridge;

FIG. 3 is a schematic block diagram of the Artcam Central Processor;

FIG. 3( a) illustrates the VLIW Vector Processor in more detail;

FIG. 3A is a schematic block diagram of the Artcam Central Processorincorporating an interface for the array of capacitive sensors;

FIG. 4 illustrates the Processing Unit in more detail;

FIG. 5 illustrates the ALU 188 in more detail;

FIG. 6 illustrates the In block in more detail;

FIG. 7 illustrates the Out block in more detail;

FIG. 8 illustrates the Registers block in more detail;

FIG. 9 illustrates the Crossbar1 in more detail;

FIG. 10 illustrates the Crossbar2 in more detail;

FIG. 11 illustrates the read process block in more detail;

FIG. 12 illustrates the read process block in more detail;

FIG. 13 illustrates the barrel shifter block in more detail;

FIG. 14 illustrates the adder/logic block in more detail;

FIG. 15 illustrates the multiply block in more detail;

FIG. 16 illustrates the I/O address generator block in more detail;

FIG. 17 illustrates a pixel storage format;

FIG. 18 illustrates a sequential read iterator process;

FIG. 19 illustrates a box read iterator process;

FIG. 20 illustrates a box write iterator process;

FIG. 21 illustrates the vertical strip read/write iterator process;

FIG. 22 illustrates the vertical strip read/write iterator process;

FIG. 23 illustrates the generate sequential process;

FIG. 24 illustrates the generate sequential process;

FIG. 25 illustrates the generate vertical strip process;

FIG. 26 illustrates the generate vertical strip process;

FIG. 27 illustrates a pixel data configuration;

FIG. 28 illustrates a pixel processing process;

FIG. 29 illustrates a schematic block diagram of the display controller;

FIG. 30 illustrates the CCD image organization;

FIG. 31 illustrates the storage format for a logical image;

FIG. 32 illustrates the internal image memory storage format;

FIG. 33 illustrates the image pyramid storage format;

FIG. 34 illustrates a time line of the process of sampling an Artcard;

FIG. 35 illustrates the super sampling process;

FIG. 36 illustrates the process of reading a rotated Artcard;

FIG. 37 illustrates a flow chart of the steps necessary to decode anArtcard;

FIG. 38 illustrates an enlargement of the left hand corner of a singleArtcard;

FIG. 39 illustrates a single target for detection;

FIG. 40 illustrates the method utilised to detect targets;

FIG. 41 illustrates the method of calculating the distance between twotargets;

FIG. 42 illustrates the process of centroid drift;

FIG. 43 shows one form of centroid lookup table;

FIG. 44 illustrates the centroid updating process;

FIG. 45 illustrates a delta processing lookup table utilised in thepreferred embodiment;

FIG. 46 illustrates the process of unscrambling Artcard data;

FIG. 47 illustrates a magnified view of a series of dots;

FIG. 48 illustrates the data surface of a dot card;

FIG. 49 illustrates schematically the layout of a single datablock;

FIG. 50 illustrates a single datablock;

FIG. 51 and FIG. 52 illustrate magnified views of portions of thedatablock of FIG. 50;

FIG. 53 illustrates a single target structure;

FIG. 54 illustrates the target structure of a datablock;

FIG. 55 illustrates the positional relationship of targets relative toborder clocking regions of a data region;

FIG. 56 illustrates the orientation columns of a datablock;

FIG. 57 illustrates the array of dots of a datablock;

FIG. 58 illustrates schematically the structure of data for Reed-Solomonencoding;

FIG. 59 illustrates an example Reed-Solomon encoding;

FIG. 60 illustrates the Reed-Solomon encoding process;

FIG. 61 illustrates the layout of encoded data within a datablock;

FIG. 62 illustrates the sampling process in sampling an alternativeArtcard;

FIG. 63 illustrates, in exaggerated form, an example of sampling arotated alternative Artcard;

FIG. 64 illustrates the scanning process;

FIG. 65 illustrates the likely scanning distribution of the scanningprocess;

FIG. 66 illustrates the relationship between probability of symbolerrors and Reed-Solomon block errors;

FIG. 67 illustrates a flow chart of the decoding process;

FIG. 68 illustrates a process utilization diagram of the decodingprocess;

FIG. 69 illustrates the dataflow steps in decoding;

FIG. 70 illustrates the reading process in more detail;

FIG. 71 illustrates the process of detection of the start of analternative Artcard in more detail;

FIG. 72 illustrates the extraction of bit data process in more detail;

FIG. 73 illustrates the segmentation process utilized in the decodingprocess;

FIG. 74 illustrates the decoding process of finding targets in moredetail;

FIG. 75 illustrates the data structures utilized in locating targets;

FIG. 76 illustrates the Lancos 3 function structure;

FIG. 77 illustrates an enlarged portion of a datablock illustrating theclockmark and border region;

FIG. 78 illustrates the processing steps in decoding a bit image;

FIG. 79 illustrates the dataflow steps in decoding a bit image;

FIG. 80 illustrates the descrambling process of the preferredembodiment;

FIG. 81 illustrates one form of implementation of the convolver;

FIG. 82 illustrates a convolution process;

FIG. 83 illustrates the compositing process;

FIG. 84 illustrates the regular compositing process in more detail;

FIG. 85 illustrates the process of warping using a warp map;

FIG. 86 illustrates the warping bi-linear interpolation process;

FIG. 87 illustrates the process of span calculation;

FIG. 88 illustrates the basic span calculation process;

FIG. 89 illustrates one form of detail implementation of the spancalculation process;

FIG. 90 illustrates the process of reading image pyramid levels;

FIG. 91 illustrates using the pyramid table for bilinear interpolation;

FIG. 92 illustrates the histogram collection process;

FIG. 93 illustrates the color transform process;

FIG. 94 illustrates the color conversion process;

FIG. 95 illustrates the color space conversion process in more detail;

FIG. 96 illustrates the process of calculating an input coordinate;

FIG. 97 illustrates the process of compositing with feedback;

FIG. 98 illustrates the generalized scaling process;

FIG. 99 illustrates the scale in X scaling process;

FIG. 100 illustrates the scale in Y scaling process;

FIG. 101 illustrates the tessellation process;

FIG. 102 illustrates the sub-pixel translation process;

FIG. 103 illustrates the compositing process;

FIG. 104 illustrates the process of compositing with feedback;

FIG. 105 illustrates the process of tiling with color from the inputimage;

FIG. 106 illustrates the process of tiling with feedback;

FIG. 107 illustrates the process of tiling with texture replacement;

FIG. 108 illustrates the process of tiling with color from the inputimage;

FIG. 109 illustrates the process of applying a texture without feedback;

FIG. 110 illustrates the process of applying a texture with feedback;

FIG. 111 illustrates the process of rotation of CCD pixels;

FIG. 112 illustrates the process of interpolation of Green subpixels;

FIG. 113 illustrates the process of interpolation of Blue subpixels;

FIG. 114 illustrates the process of interpolation of Red subpixels;

FIG. 115 illustrates the process of CCD pixel interpolation with 0degree rotation for odd pixel lines;

FIG. 116 illustrates the process of CCD pixel interpolation with 0degree rotation for even pixel lines;

FIG. 117 illustrates the process of color conversion to Lab color space;

FIG. 118 illustrates the logical layout of a single printhead;

FIG. 119 illustrates the structure of the printhead interface;

FIG. 120 illustrates the process of rotation of a Lab image;

FIG. 121 illustrates the format of a pixel of the printed image;

FIG. 122 illustrates the dithering process;

FIG. 123 illustrates the process of generating an 8 bit dot output;

FIG. 124 illustrates a perspective view of the card reader;

FIG. 125 illustrates an exploded perspective of a card reader;

FIG. 126 illustrates a close up view of the Artcard reader;

FIG. 127 illustrates a layout of the software/hardware modules of theoverall Artcam application;

FIG. 128 illustrates a layout of the software/hardware modules of theCamera Manager;

FIG. 129 illustrates a layout of the software/hardware modules of theImage Processing Manager;

FIG. 130 illustrates a layout of the software/hardware modules of thePrinter Manager;

FIG. 131 illustrates a layout of the software/hardware modules of theImage Processing Manager;

FIG. 132 illustrates a layout of the software/hardware modules of theFile Manager;

DESCRIPTION OF PREFERRED AND OTHER EMBODIMENTS

The digital image processing camera system constructed in accordancewith the preferred embodiment is as illustrated in FIG. 1. The cameraunit 1 includes means for the insertion of an integral print roll (notshown). The camera unit 1 can include an area image sensor 2 whichsensors an image 3 for captured by the camera. Optionally, the secondarea image sensor can be provided to also image the scene 3 and tooptionally provide for the production of stereographic output effects.

The camera 1 can include an optional color display 5 for the display ofthe image being sensed by the sensor 2. When a simple image is beingdisplayed on the display 5, the button 6 can be depressed resulting inthe printed image 8 being output by the camera unit 1. A series ofcards, herein after known as “Artcards” 9 contain, on one surfaceencoded information and on the other surface, contain an image distortedby the particular effect produced by the Artcard 9. The Artcard 9 isinserted in an Artcard reader 10 in the side of camera 1 and, uponinsertion, results in output image 8 being distorted in the same manneras the distortion appearing on the surface of Artcard 9. Hence, by meansof this simple user interface a user wishing to produce a particulareffect can insert one of many Artcards 9 into the Artcard reader 10 andutilize button 19 to take a picture of the image 3 resulting in acorresponding distorted output image 8.

The camera unit 1 can also include a number of other control button 13,14 in addition to a simple LCD output display 15 for the display ofinformative information including the number of printouts left on theinternal print roll on the camera unit. Additionally, different outputformats can be controlled by CHP switch 17.

Turning now to FIG. 2, there is illustrated a schematic view of theinternal hardware of the camera unit 1. The internal hardware is basedaround an Artcam central processor unit (ACP) 31.

Artcam Central Processor 31

The Artcam central processor 31 provides many functions which form the‘heart’ of the system. The ACP 31 is preferably implemented as acomplex, high speed, CMOS system on-a-chip. Utilising standard celldesign with some full custom regions is recommended. Fabrication on a0.25 micron CMOS process will provide the density and speed required,along with a reasonably small die area.

The functions provided by the ACP 31 include:

1. Control and digitization of the area image sensor 2. A 3Dstereoscopic version of the ACP requires two area image sensorinterfaces with a second optional image sensor 4 being provided forstereoscopic effects.

2. Area image sensor compensation, reformatting, and image enhancement.

3. Memory interface and management to a memory store 33.

4. Interface, control, and analog to digital conversion of an Artcardreader linear image sensor 34 which is provided for the reading of datafrom the Artcards 9.

5. Extraction of the raw Artcard data from the digitized and encodedArtcard image.

6. Reed-Solomon error detection and correction of the Artcard encodeddata. The encoded surface of the Artcard 9 includes information on howto process an image to produce the effects displayed on the imagedistorted surface of the Artcard 9. This information is in the form of ascript, hereinafter known as a “Vark script”. The Vark script isutilised by an interpreter running within the ACP 31 to produce thedesired effect.

7. Interpretation of the Vark script on the Artcard 9.

8. Performing image processing operations as specified by the Varkscript.

9. Controlling various motors for the paper transport 36, zoom lens 38,autofocus 39 and Artcard driver 37.

10. Controlling a guillotine actuator 40 for the operation of aguillotine 41 for the cutting of photographs 8 from print roll 42.

11. Half-toning of the image data for printing.

12. Providing the print data to a print-head 44 at the appropriatetimes.

13. Controlling the print head 44.

14. Controlling the ink pressure feed to print-head 44.

15. Controlling optional flash unit 56.

16. Reading and acting on various sensors in the camera, includingcamera orientation sensor 46, autofocus 47 and Artcard insertion sensor49.

17. Reading and acting on the user interface buttons 6, 13, 14.

18. Controlling the status display 15.

19. Providing viewfinder and preview images to the color display 5.

20. Control of the system power consumption, including the ACP powerconsumption via power management circuit 51.

21. Providing external communications 52 to general purpose computers(using part USB).

22. Reading and storing information in a printing roll authenticationchip 53.

23. Reading and storing information in a camera authentication chip 54.

24. Communicating with an optional mini-keyboard 57 for textmodification.

Quartz Crystal 58

A quartz crystal 58 is used as a frequency reference for the systemclock. As the system clock is very high, the ACP 31 includes a phaselocked loop clock circuit to increase the frequency derived from thecrystal 58.

Image Sensing Area Image Sensor 2

The area image sensor 2 converts an image through its lens into anelectrical signal. It can either be a charge coupled device (CCD) or anactive pixel sensor (APS)CMOS image sector. At present, available CCD'snormally have a higher image quality, however, there is currently muchdevelopment occurring in CMOS imagers. CMOS imagers are eventuallyexpected to be substantially cheaper than CCD's have smaller pixelareas, and be able to incorporate drive circuitry and signal processing.They can also be made in CMOS fabs, which are transitioning to 12″wafers. CCD's are usually built in 6″ wafer fabs, and economics may notallow a conversion to 12″ fabs. Therefore, the difference in fabricationcost between CCD's and CMOS imagers is likely to increase, progressivelyfavoring CMOS imagers. However, at present, a CCD is probably the bestoption.

The Artcam unit will produce suitable results with a 1,500×1,000 areaimage sensor. However, smaller sensors, such as 750×500, will beadequate for many markets. The Artcam is less sensitive to image sensorresolution than are conventional digital cameras. This is because manyof the styles contained on Artcards 9 process the image in such a way asto obscure the lack of resolution. For example, if the image isdistorted to simulate the effect of being converted to animpressionistic painting, low source image resolution can be used withminimal effect. Further examples for which low resolution input imageswill typically not be noticed include image warps which produce highdistorted images, multiple miniature copies of the of the image (eg.passport photos), textural processing such as bump mapping for a baserelief metal look, and photo-compositing into structured scenes.

This tolerance of low resolution image sensors may be a significantfactor in reducing the manufacturing cost of an Artcam unit 1 camera. AnArtcam with a low cost 750×500 image sensor will often produce superiorresults to a conventional digital camera with a much more expensive1,500×1,000 image sensor.

Optional Stereoscopic 3D Image Sensor 4

The 3D versions of the Artcam unit 1 have an additional image sensor 4,for stereoscopic operation. This image sensor is identical to the mainimage sensor. The circuitry to drive the optional image sensor may beincluded as a standard part of the ACP chip 31 to reduce incrementaldesign cost. Alternatively, a separate 3D Artcam ACP can be designed.This option will reduce the manufacturing cost of a mainstream singlesensor Artcam.

Print Roll Authentication Chip 53

A small chip 53 is included in each print roll 42. This chip replacedthe functions of the bar code, optical sensor and wheel, and ISO/ASAsensor on other forms of camera film units such as Advanced PhotoSystems film cartridges.

The authentication chip also provides other features:

1. The storage of data rather than that which is mechanically andoptically sensed from APS rolls

2. A remaining media length indication, accurate to high resolution.

3. Authentication Information to prevent inferior clone print rollcopies.

The authentication chip 53 contains 1024 bits of Flash memory, of which128 bits is an authentication key, and 512 bits is the authenticationinformation. Also included is an encryption circuit to ensure that theauthentication key cannot be accessed directly.

Print-Head 44

The Artcam unit 1 can utilize any color print technology which is smallenough, low enough power, fast enough, high enough quality, and lowenough cost, and is compatible with the print roll. Relevant printheadswill be specifically discussed hereinafter.

The specifications of the ink jet head are:

Image type Bi-level, dithered Color CMY Process Color Resolution 1600dpi Print head length ‘Page-width’ (100 mm) Print speed 2 seconds perphoto

Optional Ink Pressure Controller (Not Shown)

The function of the ink pressure controller depends upon the type of inkjet print head 44 incorporated in the Artcam. For some types of ink jet,the use of an ink pressure controller can be eliminated, as the inkpressure is simply atmospheric pressure. Other types of print headrequire a regulated positive ink pressure. In this case, the in pressurecontroller consists of a pump and pressure transducer.

Other print heads may require an ultrasonic transducer to cause regularoscillations in the ink pressure, typically at frequencies around 100KHz. In the case, the ACP 31 controls the frequency phase and amplitudeof these oscillations.

Paper Transport Motor 36

The paper transport motor 36 moves the paper from within the print roll42 past the print head at a relatively constant rate. The motor 36 is aminiature motor geared down to an appropriate speed to drive rollerswhich move the paper. A high quality motor and mechanical gears arerequired to achieve high image quality, as mechanical rumble or othervibrations will affect the printed dot row spacing.

Paper Transport Motor Driver 60

The motor driver 60 is a small circuit which amplifies the digital motorcontrol signals from the APC 31 to levels suitable for driving the motor36.

Paper Pull Sensor

A paper pull sensor 50 detects a user's attempt to pull a photo from thecamera unit during the printing process. The APC 31 reads this sensor50, and activates the guillotine 41 if the condition occurs. The paperpull sensor 50 is incorporated to make the camera more ‘foolproof’ inoperation. Were the user to pull the paper out forcefully duringprinting, the print mechanism 44 or print roll 42 may (in extreme cases)be damaged. Since it is acceptable to pull out the ‘pod’ from a Polaroidtype camera before it is fully ejected, the public has been ‘trained’ todo this. Therefore, they are unlikely to heed printed instructions notto pull the paper.

The Artcam preferably restarts the photo print process after theguillotine 41 has cut the paper after pull sensing.

The pull sensor can be implemented as a strain gauge sensor, or as anoptical sensor detecting a small plastic flag which is deflected by thetorque that occurs on the paper drive rollers when the paper is pulled.The latter implementation is recommendation for low cost.

Paper Guillotine Actuator 40

The paper guillotine actuator 40 is a small actuator which causes theguillotine 41 to cut the paper either at the end of a photograph, orwhen the paper pull sensor 50 is activated.

The guillotine actuator 40 is a small circuit which amplifies aguillotine control signal from the APC tot the level required by theactuator 41.

Artcard 9

The Artcard 9 is a program storage medium for the Artcam unit. As notedpreviously, the programs are in the form of Vark scripts. Vark is apowerful image processing language especially developed for the Artcamunit. Each Artcard 9 contains one Vark script, and thereby defines oneimage processing style.

Preferably, the VARK language is highly image processing specific. Bybeing highly image processing specific, the amount of storage requiredto store the details on the card are substantially reduced. Further, theease with which new programs can be created, including enhanced effects,is also substantially increased. Preferably, the language includesfacilities for handling many image processing functions including imagewarping via a warp map, convolution, color lookup tables, posterizing animage, adding noise to an image, image enhancement filters, paintingalgorithms, brush jittering and manipulation edge detection filters,tiling, illumination via light sources, bump maps, text, face detectionand object detection attributes, fonts, including three dimensionalfonts, and arbitrary complexity pre-rendered icons. Further details ofthe operation of the Vark language interpreter are containedhereinafter.

Hence, by utilizing the language constructs as defined by the createdlanguage, new affects on arbitrary images can be created and constructedfor inexpensive storage on Artcard and subsequent distribution to cameraowners. Further, on one surface of the card can be provided an exampleillustrating the effect that a particular VARK script, stored on theother surface of the card, will have on an arbitrary captured image.

By utilizing such a system, camera technology can be distributed withouta great fear of obsolescence in that, provided a VARK interpreter isincorporated in the camera device, a device independent scenario isprovided whereby the underlying technology can be completely varied overtime. Further, the VARK scripts can be updated as new filters arecreated and distributed in an inexpensive manner, such as via simplecards for card reading.

The Artcard 9 is a piece of thin white plastic with the same format as acredit card (86 mm long by 54 mm wide). The Artcard is printed on bothsides using a high resolution ink jet printer. The inkjet printertechnology is assumed to be the same as that used in the Artcam, with1600 dpi (63 dpmm) resolution. A major feature of the Artcard 9 is lowmanufacturing cost. Artcards can be manufactured at high speeds as awide web of plastic film. The plastic web is coated on both sides with ahydrophilic dye fixing layer. The web is printed simultaneously on bothsides using a ‘pagewidth’ color ink jet printer. The web is then cut andpunched into individual cards. On one face of the card is printed ahuman readable representation of the effect the Artcard 9 will have onthe sensed image. This can be simply a standard image which has beenprocessed using the Vark script stored on the back face of the card.

On the back face of the card is printed an array of dots which can bedecoded into the Vark script that defines the image processing sequence.The print area is 80 mm×50 mm, giving a total of 15,876,000 dots. Thisarray of dots could represent at least 1.89 Mbytes of data. To achievehigh reliability, extensive error detection and correction isincorporated in the array of dots. This allows a substantial portion ofthe card to be defaced, worn, creased, or dirty with no effect on dataintegrity. The data coding used is Reed-Solomon coding, with half of thedata devoted to error correction. This allows the storage of 967 Kbytesof error corrected data on each Artcard 9.

Linear Image Sensor 34

The Artcard linear sensor 34 converts the aforementioned Artcard dataimage to electrical signals. As with the area image sensor 2, 4, thelinear image sensor can be fabricated using either CCD or APS CMOStechnology. The active length of the image sensor 34 is 50 mm, equal tothe width of the data array on the Artcard 9. To satisfy Nyquist'ssampling theorem, the resolution of the linear image sensor 34 must beat least twice the highest spatial frequency of the Artcard opticalimage reaching the image sensor. In practice, data detection is easierif the image sensor resolution is substantially above this. A resolutionof 4800 dpi (189 dpmm) is chosen, giving a total of 9,450 pixels. Thisresolution requires a pixel sensor pitch of 5.3 μm. This can readily beachieved by using four staggered rows of 20 μm pixel sensors.

The linear image sensor is mounted in a special package which includes aLED 65 to illuminate the Artcard 9 via a light-pipe (not shown).

The Artcard reader light-pipe can be a molded light-pipe which hasseveral function:

1. It diffuses the light from the LED over the width of the card usingtotal internal reflection facets.

2. It focuses the light onto a 16 μm wide strip of the Artcard 9 usingan integrated cylindrical lens.

3. It focuses light reflected from the Artcard onto the linear imagesensor pixels using a molded array of microlenses.

The operation of the Artcard reader is explained further hereinafter.

Artcard Reader Motor 37

The Artcard reader motor propels the Artcard past the linear imagesensor 34 at a relatively constant rate. As it may not be cost effectiveto include extreme precision mechanical components in the Artcardreader, the motor 37 is a standard miniature motor geared down to anappropriate speed to drive a pair of rollers which move the Artcard 9.The speed variations, rumble, and other vibrations will affect the rawimage data as circuitry within the APC 31 includes extensivecompensation for these effects to reliably read the Artcard data.

The motor 37 is driven in reverse when the Artcard is to be ejected.

Artcard Motor Driver 61

The Artcard motor driver 61 is a small circuit which amplifies thedigital motor control signals from the APC 31 to levels suitable fordriving the motor 37.

Card Insertion Sensor 49

The card insertion sensor 49 is an optical sensor which detects thepresence of a card as it is being inserted in the card reader 34. Upon asignal from this sensor 49, the APC 31 initiates the card readingprocess, including the activation of the Artcard reader motor 37.

Card Eject Button 16

A card eject button 16 (FIG. 1) is used by the user to eject the currentArtcard, so that another Artcard can be inserted. The APC 31 detects thepressing of the button, and reverses the Artcard reader motor 37 toeject the card.

Card Status Indicator 66

A card status indicator 66 is provided to signal the user as to thestatus of the Artcard reading process. This can be a standard bi-color(red/green) LED. When the card is successfully read, and data integrityhas been verified, the LED lights up green continually. If the card isfaulty, then the LED lights up red.

If the camera is powered from a 1.5 V instead of 3V battery, then thepower supply voltage is less than the forward voltage drop of the greedLED, and the LED will not light. In this case, red LEDs can be used, orthe LED can be powered from a voltage pump which also powers othercircuits in the Artcam which require higher voltage.

64 Mbit DRAM 33

To perform the wide variety of image processing effects, the camerautilizes 8 Mbytes of memory 33. This can be provided by a single 64 Mbitmemory chip. Of course, with changing memory technology increased Dramstorage sizes may be substituted.

High speed access to the memory chip is required. This can be achievedby using a Rambus DRAM (burst access rate of 500 Mbytes per second) orchips using the new open standards such as double data rate (DDR) SDRAMor Synclink DRAM.

Camera Authentication Chip

The camera authentication chip 54 is identical to the print rollauthentication chip 53, except that it has different information storedin it. The camera authentication chip 54 has three main purposes:

1. To provide a secure means of comparing authentication codes with theprint roll authentication chip;

2. To provide storage for manufacturing information, such as the serialnumber of the camera;

3. To provide a small amount of non-volatile memory for storage of userinformation.

Displays

The Artcam includes an optional color display 5 and small status display15. Lowest cost consumer cameras may include a color image display, suchas a small TFT LCD 5 similar to those found on some digital cameras andcamcorders. The color display 5 is a major cost element of theseversions of Artcam, and the display 5 plus back light are a major powerconsumption drain.

Status Display 15

The status display 15 is a small passive segment based LCD, similar tothose currently provided on silver halide and digital cameras. Its mainfunction is to show the number of prints remaining in the print roll 42and icons for various standard camera features, such as flash andbattery status.

Color Display 5

The color display 5 is a full motion image display which operates as aviewfinder, as a verification of the image to be printed, and as a userinterface display. The cost of the display 5 is approximatelyproportional to its area, so large displays (say 4″ diagonal) unit willbe restricted to expensive versions of the Artcam unit. Smallerdisplays, such as color camcorder viewfinder TFT's at around 1″, may beeffective for mid-range Artcams.

Zoom Lens (Not Shown)

The Artcam can include a zoom lens. This can be a standardelectronically controlled zoom lens, identical to one which would beused on a standard electronic camera, and similar to pocket camera zoomlenses. A referred version of the Artcam unit may include standardinterchangeable 35 mm SLR lenses.

Autofocus Motor 39

The autofocus motor 39 changes the focus of the zoom lens. The motor isa miniature motor geared down to an appropriate speed to drive theautofocus mechanism.

Autofocus Motor Driver 63

The autofocus motor driver 63 is a small circuit which amplifies thedigital motor control signals from the APC 31 to levels suitable fordriving the motor 39.

Zoom Motor 38

The zoom motor 38 moves the zoom front lenses in and out. The motor is aminiature motor geared down to an appropriate speed to drive the zoommechanism.

Zoom Motor Driver 62

The zoom motor driver 62 is a small circuit which amplifies the digitalmotor control signals from the APC 31 to levels suitable for driving themotor.

Communications

The ACP 31 contains a universal serial bus (USB) interface 52 forcommunication with personal computers. Not all Artcam models areintended to include the USB connector. However, the silicon arearequired for a USB circuit 52 is small, so the interface can be includedin the standard ACP.

Optional Keyboard 57

The Artcam unit may include an optional miniature keyboard 57 forcustomizing text specified by the Artcard. Any text appearing in anArtcard image may be editable, even if it is in a complex metallic 3Dfont. The miniature keyboard includes a single line alphanumeric LCD todisplay the original text and edited text. The keyboard may be astandard accessory.

The ACP 31 contains a serial communications circuit for transferringdata to and from the miniature keyboard.

Power Supply

The Artcam unit uses a battery 48. Depending upon the Artcam options,this is either a 3V Lithium cell, 1.5 V AA alkaline cells, or otherbattery arrangement.

Power Management Unit 51

Power consumption is an important design constraint in the Artcam. It isdesirable that either standard camera batteries (such as 3V lithiumbatters) or standard AA or AAA alkaline cells can be used. While theelectronic complexity of the Artcam unit is dramatically higher than 35mm photographic cameras, the power consumption need not becommensurately higher. Power in the Artcam can be carefully managed withall unit being turned off when not in use.

The most significant current drains are the ACP 31, the area imagesensors 2,4, the printer 44 various motors, the flash unit 56, and theoptional color display 5 dealing with each part separately:

1. ACP: If fabricated using 0.25 μm CMOS, and running on 1.5V, the ACPpower consumption can be quite low. Clocks to various parts of the ACPchip can be quite low. Clocks to various parts of the ACP chip can beturned off when not in use, virtually eliminating standby currentconsumption. The ACP will only fully used for approximately 4 secondsfor each photograph printed.

2. Area image sensor: power is only supplied to the area image sensorwhen the user has their finger on the button.

3. The printer power is only supplied to the printer when actuallyprinting. This is for around 2 seconds for each photograph. Even so,suitably lower power consumption printing should be used.

4. The motors required in the Artcam are all low power miniature motors,and are typically only activated for a few seconds per photo.

5. The flash unit 45 is only used for some photographs. Its powerconsumption can readily be provided by a 3V lithium battery for areasonably battery life.

6. The optional color display 5 is a major current drain for tworeasons: it must be on for the whole time that the camera is in use, anda backlight will be required if a liquid crystal display is used.Cameras which incorporate a color display will require a larger batteryto achieve acceptable batter life.

Flash Unit 56

The flash unit 56 can be a standard miniature electronic flash forconsumer cameras.

Overview of the ACP 31

FIG. 3 illustrates the Artcam Central Processor (ACP) 31 in more detail.The Artcam Central Processor provides all of the processing power forArtcam. It is designed for a 0.25 micron CMOS process, withapproximately 1.5 million transistors and an area of around 50 mm². TheACP 31 is a complex design, but design effort can be reduced by the useof datapath compilation techniques, macrocells, and IP cores. The ACP 31contains:

-   -   A RISC CPU core 72    -   A 4 way parallel VLIW Vector Processor 74    -   A Direct RAMbus interface 81    -   A CMOS image sensor interface 83    -   A CMOS linear image sensor interface 88    -   A USB serial interface 52    -   An infrared keyboard interface 55    -   A numeric LCD interface 84, and    -   A color TFT LCD interface 88    -   A 4 Mbyte Flash memory 70 for program storage 70

The RISC CPU, Direct RAMbus interface 81, CMOS sensor interface 83 andUSB serial interface 52 can be vendor supplied cores. The ACP 31 isintended to run at a clock speed of 200 MHz on 3V externally and 1.5Vinternally to minimize power consumption. The CPU core needs only to runat 100 MHz. The following two block diagrams give two views of the ACP31:

-   -   A view of the ACP 31 in isolation

An example Artcam showing a high-level view of the ACP 31 connected tothe rest of the Artcam hardware.

Image Access

As stated previously, the DRAM Interface 81 is responsible forinterfacing between other client portions of the ACP chip and the RAMBUSDRAM. In effect, each module within the DRAM Interface is an addressgenerator.

There are three logical types of images manipulated by the ACP. Theyare:

-   -   CCD Image, which is the Input Image captured from the CCD.    -   Internal Image format—the Image format utilised internally by        the Artcam device.

Print Image—the Output Image format printed by the Artcam

These images are typically different in color space, resolution, and theoutput & input color spaces which can vary from camera to camera. Forexample, a CCD image on a low-end camera may be a different resolution,or have different color characteristics from that used in a high-endcamera. However all internal image formats are the same format in termsof color space across all cameras.

In addition, the three image types can vary with respect to whichdirection is ‘up’. The physical orientation of the camera causes thenotion of a portrait or landscape image, and this must be maintainedthroughout processing. For this reason, the internal image is alwaysoriented correctly, and rotation is performed on images obtained fromthe CCD and during the print operation.

CPU Core (CPU) 72

The ACP 31 incorporates a 32 bit RISC CPU 72 to run the Vark imageprocessing language interpreter and to perform Artcam's generaloperating system duties. A wide variety of CPU cores are suitable: itcan be any processor core with sufficient processing power to performthe required core calculations and control functions fast enough to metconsumer expectations. Examples of suitable cores are: MIPS R4000 corefrom LSI Logic, StrongARM core. There is no need to maintain instructionset continuity between different Artcam models. Artcard compatibility ismaintained irrespective of future processor advances and changes,because the Vark interpreter is simply re-compiled for each newinstruction set. The ACP 31 architecture is therefore also free toevolve. Different ACP 31 chip designs may be fabricated by differentmanufacturers, without requiring to license or port the CPU core. Thisdevice independence avoids the chip vendor lock-in such as has occurredin the PC market with Intel. The CPU operates at 100 MHz, with a singlecycle time of 10 ns. It must be fast enough to run the Vark interpreter,although the VLIW Vector Processor 74 is responsible for most of thetime-critical operations.

Program Cache 72

Although the program code is stored in on-chip Flash memory 70, it isunlikely that well packed Flash memory 70 will be able to operate at the10 ns cycle time required by the CPU. Consequently a small cache isrequired for good performance. 16 cache lines of 32 bytes each aresufficient, for a total of 512 bytes. The program cache 72 is defined inthe chapter entitled Program cache 72.

Data Cache 76

A small data cache 76 is required for good performance. This requirementis mostly due to the use of a RAMbus DRAM, which can provide high-speeddata in bursts, but is inefficient for single byte accesses. The CPU hasaccess to a memory caching system that allows flexible manipulation ofCPU data cache 76 sizes. A minimum of 16 cache lines (512 bytes) isrecommended for good performance.

CPU Memory Model

An Artcam's CPU memory model consists of a 32 MB area. It consists of 8MB of physical RDRAM off-chip in the base model of Artcam, withprovision for up to 16 MB of off-chip memory. There is a 4 MB Flashmemory 70 on the ACP 31 for program storage, and finally a 4 MB addressspace mapped to the various registers and controls of the ACP 31. Thememory map then, for an Artcam is as follows:

Contents Size Base Artcam DRAM 8 MB Extended DRAM 8 MB Program memory(on ACP 31 in Flash memory 70) 4 MB Reserved for extension of programmemory 4 MB ACP 31 registers and memory-mapped I/O 4 MB Reserved 4 MBTOTAL 32 MB 

A straightforward way of decoding addresses is to use address bits23-24:

-   -   If bit 24 is clear, the address is in the lower 16-MB range, and        hence can be satisfied from DRAM and the Data cache 76. In most        cases the DRAM will only be 8 MB, but 16 MB is allocated to        cater for a higher memory model Artcams.    -   If bit 24 is set, and bit 23 is clear, then the address        represents the Flash memory 70 4 Mbyte range and is satisfied by        the Program cache 72.    -   If bit 24=1 and bit 23=1, the address is translated into an        access over the low speed bus to the requested component in the        AC by the CPU Memory Decoder 68.

Flash Memory 70

The ACP 31 contains a 4 Mbyte Flash memory 70 for storing the Artcamprogram. It is envisaged that Flash memory 70 will have denser packingcoefficients than masked ROM, and allows for greater flexibility fortesting camera program code. The downside of the Flash memory 70 is theaccess time, which is unlikely to be fast enough for the 100 MHzoperating speed (10 ns cycle time) of the CPU. A fast ProgramInstruction cache 77 therefore acts as the interface between the CPU andthe slower Flash memory 70.

Program Cache 72

A small cache is required for good CPU performance. This requirement isdue to the slow speed Flash memory 70 which stores the Program code. 16cache lines of 32 bytes each are sufficient, for a total of 512 bytes.The Program cache 72 is a read only cache. The data used by CPU programscomes through the CPU Memory Decoder 68 and if the address is in DRAM,through the general Data cache 76. The separation allows the CPU tooperate independently of the VLIW Vector Processor 74. If the datarequirements are low for a given process, it can consequently operatecompletely out of cache.

Finally, the Program cache 72 can be read as data by the CPU rather thanpurely as program instructions. This allows tables, microcode for theVLIW etc to be loaded from the Flash memory 70. Addresses with bit 24set and bit 23 clear are satisfied from the Program cache 72.

CPU Memory Decoder 68

The CPU Memory Decoder 68 is a simple decoder for satisfying CPU dataaccesses. The Decoder translates data addresses into internal ACPregister accesses over the internal low speed bus, and therefore allowsfor memory mapped I/O of ACP registers. The CPU Memory Decoder 68 onlyinterprets addresses that have bit 24 set and bit 23 clear. There is nocaching in the CPU Memory Decoder 68.

DRAM Interface 81

The DRAM used by the Artcam is a single channel 64 Mbit (8 MB) RAMbusRDRAM operating at 1.6 GB/sec. RDRAM accesses are by a single channel(16-bit data path) controller. The RDRAM also has several usefuloperating modes for low power operation. Although the Rambusspecification describes a system with random 32 byte transfers ascapable of achieving a greater than 95% efficiency, this is not true ifonly part of the 32 bytes are used. Two reads followed by two writes tothe same device yields over 86% efficiency. The primary latency isrequired for bus turn-around going from a Write to a Read, and sincethere is a Delayed Write mechanism, efficiency can be further improved.With regards to writes, Write Masks allow specific subsets of bytes tobe written to. These write masks would be set via internal cache “dirtybits”. The upshot of the Rambus Direct RDRAM is a throughput of >1GB/sec is easily achievable, and with multiple reads for every write(most processes) combined with intelligent algorithms making good use of32 byte transfer knowledge, transfer rates of >1.3 GB/sec are expected.Every 10 ns, 16 bytes can be transferred to or from the core.

Data Cache 76

The ACP 31 contains a dedicated CPU instruction cache 77 and a generaldata cache 76. The Data cache 76 handles all DRAM requests (reads andwrites of data) from the CPU, the VLIW Vector Processor 74, and theDisplay Controller 88. These requests may have very different profilesin terms of memory usage and algorithmic timing requirements. Forexample, a VLIW process may be processing an image in linear memory, andlookup a value in a table for each value in the image. There is littleneed to cache much of the image, but it may be desirable to cache theentire lookup table so that no real memory access is required. Becauseof these differing requirements, the Data cache 76 allows for anintelligent definition of caching.

Although the Rambus DRAM interface 81 is capable of very high-speedmemory access (an average throughput of 32 bytes in 25 ns), it is notefficient dealing with single byte requests. In order to reduceeffective memory latency, the ACP 31 contains 128 cache lines. Eachcache line is 32 bytes wide. Thus the total amount of data cache 76 is4096 bytes (4 KB). The 128 cache lines are configured into 16programmable-sized groups. Each of the 16 groups must be a contiguousset of cache lines. The CPU is responsible for determining how manycache lines to allocate to each group. Within each group cache lines arefilled according to a simple Least Recently Used algorithm. In terms ofCPU data requests, the Data cache 76 handles memory access requests thathave address bit 24 clear. If bit 24 is clear, the address is in thelower 16 MB range, and hence can be satisfied from DRAM and the Datacache 76. In most cases the DRAM will only be 8 MB, but 16 MB isallocated to cater for a higher memory model Artcam. If bit 24 is set,the address is ignored by the Data cache 76.

All CPU data requests are satisfied from Cache Group 0. A minimum of 16cache lines is recommended for good CPU performance, although the CPUcan assign any number of cache lines (except none) to Cache Group 0. Theremaining Cache Groups (1 to 15) are allocated according to the currentrequirements. This could mean allocation to a VLIW Vector Processor 74program or the Display Controller 88. For example, a 256 byte lookuptable required to be permanently available would require 8 cache lines.Writing out a sequential image would only require 2-4 cache lines(depending on the size of record being generated and whether writerequests are being Write Delayed for a significant number of cycles).Associated with each cache line byte is a dirty bit, used for creating aWrite Mask when writing memory to DRAM. Associated with each cache lineis another dirty bit, which indicates whether any of the cache linebytes has been written to (and therefore the cache line must be writtenback to DRAM before it can be reused). Note that it is possible for twodifferent Cache Groups to be accessing the same address in memory and toget out of sync. The VLIW program writer is responsible to ensure thatthis is not an issue. It could be perfectly reasonable, for example, tohave a Cache Group responsible for reading an image, and another CacheGroup responsible for writing the changed image back to memory again. Ifthe images are read or written sequentially there may be advantages inallocating cache lines in this manner. A total of 8 buses 182 connectthe VLIW Vector Processor 74 to the Data cache 76. Each bus is connectedto an I/O Address Generator. (There are 2 I/O Address Generators 189,190 per Processing Unit 178, and there are 4 Processing Units in theVLIW Vector Processor 74. The total number of buses is therefore 8.)

In any given cycle, in addition to a single 32 bit (4 byte) access tothe CPU's cache group (Group 0), 4 simultaneous accesses of 16 bits (2bytes) to remaining cache groups are permitted on the 8 VLIW VectorProcessor 74 buses. The Data cache 76 is responsible for fairlyprocessing the requests. On a given cycle, no more than 1 request to aspecific Cache Group will be processed. Given that there are 8 AddressGenerators 189, 190 in the VLIW Vector Processor 74, each one of thesehas the potential to refer to an individual Cache Group. However it ispossible and occasionally reasonable for 2 or more Address Generators189, 190 to access the same Cache Group. The CPU is responsible forensuring that the Cache Groups have been allocated the correct number ofcache lines, and that the various Address Generators 189, 190 in theVLIW Vector Processor 74 reference the specific Cache Groups correctly.

The Data cache 76 as described allows for the Display Controller 88 andVLIW Vector Processor 74 to be active simultaneously. If the operationof these two components were deemed to never occur simultaneously, atotal 9 Cache Groups would suffice. The CPU would use Cache Group 0, andthe VLIW Vector Processor 74 and the Display Controller 88 would sharethe remaining 8 Cache Groups, requiring only 3 bits (rather than 4) todefine which Cache Group would satisfy a particular request.

JTAG Interface 85

A standard JTAG (Joint Test Action Group) Interface is included in theACP 31 for testing purposes. Due to the complexity of the chip, avariety of testing techniques are required, including BIST (Built InSelf Test) and functional block isolation. An overhead of 10% in chiparea is assumed for overall chip testing circuitry. The test circuitryis beyond the scope of this document.

Serial Interfaces USB Serial Port Interface 52

This is a standard USB serial port, which is connected to the internalchip low speed bus, thereby allowing the CPU to control it.

Keyboard Interface 65

This is a standard low-speed serial port, which is connected to theinternal chip low speed bus, thereby allowing the CPU to control it. Itis designed to be optionally connected to a keyboard to allow simpledata input to customize prints.

Authentication Chip Serial Interfaces 64

These are 2 standard low-speed serial ports, which are connected to theinternal chip low speed bus, thereby allowing the CPU to control them.The reason for having 2 ports is to connect to both the on-cameraAuthentication chip, and to the print-roll Authentication chip usingseparate lines. Only using 1 line may make it possible for a cloneprint-roll manufacturer to design a chip which, instead of generating anauthentication code, tricks the camera into using the code generated bythe authentication chip in the camera.

Parallel Interface 67

The parallel interface connects the ACP 31 to individual staticelectrical signals. The CPU is able to control each of these connectionsas memory-mapped I/O via the low speed bus The following table is a listof connections to the parallel interface:

Connection Direction Pins Paper transport stepper motor Out 4 Artcardstepper motor Out 4 Zoom stepper motor Out 4 Guillotine motor Out 1Flash trigger Out 1 Status LCD segment drivers Out 7 Status LCD commondrivers Out 4 Artcard illumination LED Out 1 Artcard status LED(red/green) In 2 Artcard sensor In 1 Paper pull sensor In 1 Orientationsensor In 2 Buttons In 4 TOTAL 36

VLIW Input and Output FIFOs 78, 79

The VLIW Input and Output FIFOs are 8 bit wide FIFOs used forcommunicating between processes and the VLIW Vector Processor 74. BothFIFOs are under the control of the VLIW Vector Processor 74, but can becleared and queried (e.g. for status) etc by the CPU.

VLIW Input FIFO 78

A client writes 8-bit data to the VLIW Input FIFO 78 in order to havethe data processed by the VLIW Vector Processor 74. Clients include theImage Sensor Interface, Artcard Interface, and CPU. Each of theseprocesses is able to offload processing by simply writing the data tothe FIFO, and letting the VLIW Vector Processor 74 do all the hard work.An example of the use of a client's use of the VLIW Input FIFO 78 is theImage Sensor Interface (ISI 83). The ISI 83 takes data from the ImageSensor and writes it to the FIFO. A VLIW process takes it from the FIFO,transforming it into the correct image data format, and writing it outto DRAM. The ISI 83 becomes much simpler as a result.

VLIW Output FIFO 79

The VLIW Vector Processor 74 writes 8-bit data to the VLIW Output FIFO79 where clients can read it. Clients include the Print Head Interfaceand the CPU. Both of these clients is able to offload processing bysimply reading the already processed data from the FIFO, and letting theVLIW Vector Processor 74 do all the hard work. The CPU can also beinterrupted whenever data is placed into the VLIW Output FIFO 79,allowing it to only process the data as it becomes available rather thanpolling the FIFO continuously. An example of the use of a client's useof the VLIW Output FIFO 79 is the Print Head Interface (PHI 62). A VLIWprocess takes an image, rotates it to the correct orientation, colorconverts it, and dithers the resulting image according to the print headrequirements. The PHI 62 reads the dithered formatted 8-bit data fromthe VLIW Output FIFO 79 and simply passes it on to the Print Headexternal to the ACP 31. The PHI 62 becomes much simpler as a result.

VLIW Vector Processor 74

To achieve the high processing requirements of Artcam, the ACP 31contains a VLIW (Very Long Instruction Word) Vector Processor. The VLIWprocessor is a set of 4 identical Processing Units (PU e.g 178) workingin parallel, connected by a crossbar switch 183. Each PU e.g 178 canperform four 8-bit multiplications, eight 8-bit additions, three 32-bitadditions, I/O processing, and various logical operations in each cycle.The PUs e.g 178 are microcoded, and each has two Address Generators 189,190 to allow full use of available cycles for data processing. The fourPUs e.g 178 are normally synchronized to provide a tightly interactingVLIW processor. Clocking at 200 MHz, the VLIW Vector Processor 74 runsat 12 Gops (12 billion operations per second). Instructions are tunedfor image processing functions such as warping, artistic brushing,complex synthetic illumination, color transforms, image filtering, andcompositing. These are accelerated by two orders of magnitude overdesktop computers.

As shown in more detail in FIG. 3( a), the VLIW Vector Processor 74 is 4PUs e.g 178 connected by a crossbar switch 183 such that each PU e.g 178provides two inputs to, and takes two outputs from, the crossbar switch183. Two common registers form a control and synchronization mechanismfor the PUs e.g 178. 8 Cache buses 182 allow connectivity to DRAM viathe Data cache 76, with 2 buses going to each PU e.g 178 (1 bus per I/OAddress Generator).

Each PU e.g 178 consists of an ALU 188 (containing a number of registers& some arithmetic logic for processing data), some microcode RAM 196,and connections to the outside world (including other ALUs). A local PUstate machine runs in microcode and is the means by which the PU e.g 178is controlled. Each PU e.g 178 contains two I/O Address Generators 189,190 controlling data flow between DRAM (via the Data cache 76) and theALU 188 (via Input FIFO and Output FIFO). The address generator is ableto read and write data (specifically images in a variety of formats) aswell as tables and simulated FIFOs in DRAM. The formats are customizableunder software control, but are not microcoded. Data taken from the Datacache 76 is transferred to the ALU 188 via the 16-bit wide Input FIFO.Output data is written to the 16-bit wide Output FIFO and from there tothe Data cache 76. Finally, all PUs e.g 178 share a single 8-bit wideVLIW Input FIFO 78 and a single 8-bit wide VLIW Output FIFO 79. The lowspeed data bus connection allows the CPU to read and write registers inthe PU e.g 178, update microcode, as well as the common registers sharedby all PUs e.g 178 in the VLIW Vector Processor 74. Turning now to FIG.4, a closer detail of the internals of a single PU e.g 178 can be seen,with components and control signals detailed in subsequent hereinafter:

Microcode

Each PU e.g 178 contains a microcode RAM 196 to hold the program forthat particular PU e.g 178. Rather than have the microcode in ROM, themicrocode is in RAM, with the CPU responsible for loading it up. For thesame space on chip, this tradeoff reduces the maximum size of any onefunction to the size of the RAM, but allows an unlimited number offunctions to be written in microcode. Functions implemented usingmicrocode include Vark acceleration, Artcard reading, and Printing. TheVLIW Vector Processor 74 scheme has several advantages for the case ofthe ACP 31:

-   -   Hardware design complexity is reduced    -   Hardware risk is reduced due to reduction in complexity    -   Hardware design time does not depend on all Vark functionality        being implemented in dedicated silicon    -   Space on chip is reduced overall (due to large number of        processes able to be implemented as microcode)    -   Functionality can be added to Vark (via microcode) with no        impact on hardware design time

Size and Content

The CPU loaded microcode RAM 196 for controlling each PU e.g 178 is 128words, with each word being 96 bits wide. A summary of the microcodesize for control of various units of the PU e.g 178 is listed in thefollowing table:

Process Block Size (bits) Status Output 3 Branching (microcode control)11 In 8 Out 6 Registers 7 Read 10 Write 6 Barrel Shifter 12Adder/Logical 14 Multiply/Interpolate 19 TOTAL 96

With 128 instruction words, the total microcode RAM 196 per PU e.g 178is 12,288 bits, or 1.5 KB exactly. Since the VLIW Vector Processor 74consists of 4 identical PUs e.g 178 this equates to 6,144 bytes, exactly6 KB. Some of the bits in a microcode word are directly used as controlbits, while others are decoded. See the various unit descriptions thatdetail the interpretation of each of the bits of the microcode word.

Synchronization Between Pus e.g 178

Each PU e.g 178 contains a 4 bit Synchronization Register 197. It is amask used to determine which PUs e.g 178 work together, and has one bitset for each of the corresponding PUs e.g 178 that are functioning as asingle process. For example, if all of the PUs e.g 178 were functioningas a single process, each of the 4 Synchronization Register 197 s wouldhave all 4 bits set. If there were two asynchronous processes of 2 PUse.g 178 each, two of the PUs e.g 178 would have 2 bits set in theirSynchronization Register 197 s (corresponding to themselves), and theother two would have the other 2 bits set in their SynchronizationRegister 197 s (corresponding to themselves).

The Synchronization Register 197 is used in two basic ways:

-   -   Stopping and starting a given process in synchrony    -   Suspending execution within a process

Stopping and Starting Processes

The CPU is responsible for loading the microcode RAM 196 and loading theexecution address for the first instruction (usually 0). When the CPUstarts executing microcode, it begins at the specified address.

Execution of microcode only occurs when all the bits of theSynchronization Register 197 are also set in the Common SynchronizationRegister 197. The CPU therefore sets up all the PUs e.g 178 and thenstarts or stops processes with a single write to the CommonSynchronization Register 197.

This synchronization scheme allows multiple processes to be runningasynchronously on the PUs e.g 178, being stopped and started asprocesses rather than one PU e.g 178 at a time.

Suspending Execution within a Process

In a given cycle, a PU e.g 178 may need to read from or write to a FIFO(based on the opcode of the current microcode instruction). If the FIFOis empty on a read request, or full on a write request, the FIFO requestcannot be completed. The PU e.g 178 will therefore assert itsSuspendProcess control signal 198. The SuspendProcess signals from allPUs e.g 178 are fed back to all the PUs e.g 178.

The Synchronization Register 197 is ANDed with the 4 SuspendProcessbits, and if the result is non-zero, none of the PU e.g 178's registerWriteEnables or FIFO strobes will be set. Consequently none of the PUse.g 178 that form the same process group as the PU e.g 178 that wasunable to complete its task will have their registers or FIFOs updatedduring that cycle. This simple technique keeps a given process group insynchronization. Each subsequent cycle the PU e.g 178's state machinewill attempt to re-execute the microcode instruction at the sameaddress, and will continue to do so until successful. Of course theCommon Synchronization Register 197 can be written to by the CPU to stopthe entire process if necessary. This synchronization scheme allows anycombinations of PUs e.g 178 to work together, each group only affectingits co-workers with regards to suspension due to data not being readyfor reading or writing.

Control and Branching

During each cycle, each of the four basic input and calculation unitswithin a PU e.g 178's ALU 188 (Read, Adder/Logic, Multiply/Interpolate,and Barrel Shifter) produces two status bits: a Zero flag and a Negativeflag indicating whether the result of the operation during that cyclewas 0 or negative. Each cycle one of those 4 status bits is chosen bymicrocode instructions to be output from the PU e.g 178. The 4 statusbits (1 per PU e.g 178's ALU 188) are combined into a 4 bit CommonStatus Register 200. During the next cycle, each PU e.g 178's microcodeprogram can select one of the bits from the Common Status Register 200,and branch to another microcode address dependant on the value of thestatus bit.

Status Bit

Each PU e.g 178's ALU 188 contains a number of input and calculationunits. Each unit produces 2 status bits—a negative flag and a zero flag.One of these status bits is output from the PU e.g 178 when a particularunit asserts the value on the 1-bit tri-state status bit bus. The singlestatus bit is output from the PU e.g 178, and then combined with theother PU e.g 178 status bits to update the Common Status Register 200.The microcode for determining the output status bit takes the followingform:

# Bits Description 2 Select unit whose status bit is to be output 00 =Adder unit 01 = Multiply/Logic unit 10 = Barrel Shift unit 11 = Readerunit 1 0 = Zero flag 1 = Negative flag 3 TOTAL

Within the ALU 188, the 2-bit Select Processor Block value is decodedinto four 1-bit enable bits, with a different enable bit sent to eachprocessor unit block. The status select bit (choosing Zero or Negative)is passed into all units to determine which bit is to be output onto thestatus bit bus.

Branching within Microcode

Each PU e.g 178 contains a 7 bit Program Counter (PC) that holds thecurrent microcode address being executed. Normal program execution islinear, moving from address N in one cycle to address N+1 in the nextcycle. Every cycle however, a microcode program has the ability tobranch to a different location, or to test a status bit from the CommonStatus Register 200 and branch. The microcode for determining the nextexecution address takes the following form:

# Bits Description 2 00 = NOP (PC = PC + 1) 01 = Branch always 10 =Branch if status bit clear 11 = Branch if status bit set 2 Select statusbit from status word 7 Address to branch to (absolute address, 00-7F) 11TOTAL

ALU 188

FIG. 5 illustrates the ALU 188 in more detail. Inside the ALU 188 are anumber of specialized processing blocks, controlled by a microcodeprogram. The specialized processing blocks include:

-   -   Read Block 202, for accepting data from the input FIFOs    -   Write Block 203, for sending data out via the output FIFOs    -   Adder/Logical block 204, for addition & subtraction, comparisons        and logical operations    -   Multiply/Interpolate block 205, for multiple types of        interpolations and multiply/accumulates    -   Barrel Shift block 206, for shifting data as required    -   In block 207, for accepting data from the external crossbar        switch 183    -   Out block 208, for sending data to the external crossbar switch        183    -   Registers block 215, for holding data in temporary storage

Four specialized 32 bit registers hold the results of the 4 mainprocessing blocks:

-   -   M register 209 holds the result of the Multiply/Interpolate        block    -   L register 209 holds the result of the Adder/Logic block    -   S register 209 holds the result of the Barrel Shifter block    -   R register 209 holds the result of the Read Block 202

In addition there are two internal crossbar switches 213 m 214 for datatransport. The various process blocks are further expanded in thefollowing sections, together with the microcode definitions that pertainto each block. Note that the microcode is decoded within a block toprovide the control signals to the various units within.

Data Transfers Between PUs e.g 178

Each PU e.g 178 is able to exchange data via the external crossbar. A PUe.g 178 takes two inputs and outputs two values to the externalcrossbar. In this way two operands for processing can be obtained in asingle cycle, but cannot be actually used in an operation until thefollowing cycle.

In 207

This block is illustrated in FIG. 6 and contains two registers, In₁ andIn₂ that accept data from the external crossbar. The registers can beloaded each cycle, or can remain unchanged. The selection bits forchoosing from among the 8 inputs are output to the external crossbarswitch 183. The microcode takes the following form:

# Bits Description 1 0 = NOP 1 = Load In₁ from crossbar 3 Select Input 1from external crossbar 1 0 = NOP 1 = Load In₂ from crossbar 3 SelectInput 2 from external crossbar 8 TOTAL

Out 208

Complementing In is Out 208. The Out block is illustrated in more detailin FIG. 7. Out contains two registers, Out₁ and Out₂, both of which areoutput to the external crossbar each cycle for use by other PUs e.g 178.The Write unit is also able to write one of Out₁ or Out₂ to one of theoutput FIFOs attached to the ALU 188. Finally, both registers areavailable as inputs to Crossbar1 213, which therefore makes the registervalues available as inputs to other units within the ALU 188. Each cycleeither of the two registers can be updated according to microcodeselection. The data loaded into the specified register can be one ofD₁-D₃ (selected from Crossbar1 213) one of M, L, S, and R (selected fromCrossbar2 214), one of 2 programmable constants, or the fixed values 0or 1. The microcode for Out takes the following form:

# Bits Description 1 0 = NOP 1 = Load Register 1 Select Register to load[Out₁ or Out₂] 4 Select input [In₁, In₂, Out₁ , Out₂, D₀, D₁, D₂, D₃, M,L, S, R, K₁, K₂, 0, 1] 6 TOTAL

Local Registers and Data Transfers within ALU 188

As noted previously, the ALU 188 contains four specialized 32-bitregisters to hold the results of the 4 main processing blocks:

-   -   M register 209 holds the result of the Multiply/Interpolate        block    -   L register 209 holds the result of the Adder/Logic block    -   S register 209 holds the result of the Barrel Shifter block    -   R register 209 holds the result of the Read Block 202

The CPU has direct access to these registers, and other units can selectthem as inputs via Crossbar2 214. Sometimes it is necessary to delay anoperation for one or more cycles. The Registers block contains four32-bit registers D₀-D₃ to hold temporary variables during processing.Each cycle one of the registers can be updated, while all the registersare output for other units to use via Crossbar1 213 (which also includesIn₁, In₂, Out₁ and Out₂). The CPU has direct access to these registers.The data loaded into the specified register can be one of D₀-D₃(selected from Crossbar1 213) one of M, L, S, and R (selected fromCrossbar2 214), one of 2 programmable constants, or the fixed values 0or 1. The Registers block 215 is illustrated in more detail in FIG. 8.The microcode for Registers takes the following form:

# Bits Description 1 0 = NOP 1 = Load Register 2 Select Register to load[D₀-D₃] 4 Select input [In₁, In₂, Out₁ , Out₂, D₀, D₁, D₂, D₃, M, L, S,R, K₁, K₂, 0, 1] 7 TOTAL

Crossbar1 213

Crossbar1 213 is illustrated in more detail in FIG. 9. Crossbar1 213 isused to select from inputs In₁, In₂, Out₁, Out₂, D₀-D₃. 7 outputs aregenerated from Crossbar1 213: 3 to the Multiply/Interpolate Unit, 2 tothe Adder Unit, 1 to the Registers unit and 1 to the Out unit. Thecontrol signals for Crossbar1 213 come from the various units that usethe Crossbar inputs. There is no specific microcode that is separate forCrossbar1 213.

Crossbar2 214

Crossbar2 214 is illustrated in more detail in FIG. 10. Crossbar2 214 isused to select from the general ALU 188 registers M, L, S and R. 6outputs are generated from Crossbar1 213: 2 to the Multiply/InterpolateUnit, 2 to the Adder Unit, 1 to the Registers unit and 1 to the Outunit. The control signals for Crossbar2 214 come from the various unitsthat use the Crossbar inputs. There is no specific microcode that isseparate for Crossbar2 214.

Data Transfers between PUs e.g 178 and DRAM or External Processes

Returning to FIG. 4, PUs e.g 178 share data with each other directly viathe external crossbar. They also transfer data to and from externalprocesses as well as DRAM. Each PU e.g 178 has 2 I/O Address Generators189, 190 for transferring data to and from DRAM. A PU e.g 178 can senddata to DRAM via an I/O Address Generator's Output FIFO e.g. 186, oraccept data from DRAM via an I/O Address Generator's Input FIFO 187.These FIFOs are local to the PU e.g 178. There is also a mechanism fortransferring data to and from external processes in the form of a commonVLIW Input FIFO 78 and a common VLIW Output FIFO 79, shared between allALUs. The VLIW Input and Output FIFOs are only 8 bits wide, and are usedfor printing, Artcard reading, transferring data to the CPU etc. Thelocal Input and Output FIFOs are 16 bits wide.

Read

The Read process block 202 of FIG. 5 is responsible for updating the ALU188's R register 209, which represents the external input data to a VLIWmicrocoded process. Each cycle the Read Unit is able to read from eitherthe common VLIW Input FIFO 78 (8 bits) or one of two local Input FIFOs(16 bits). A 32-bit value is generated, and then all or part of thatdata is transferred to the R register 209. The process can be seen inFIG. 11. The microcode for Read is described in the following table.Note that the interpretations of some bit patterns are deliberatelychosen to aid decoding.

# Bits Description 2 00 = NOP 01 = Read from VLIW Input FIFO 78 10 =Read from Local FIFO 1 11 = Read from Local FIFO 2 1 How manysignificant bits 0 = 8 bits (pad with 0 or sign extend) 1 = 16 bits(only valid for Local FIFO reads) 1 0 = Treat data as unsigned (pad with0) 1 = Treat data as signed (sign extend when reading from FIFO)r 2 Howmuch to shift data left by: 00 = 0 bits (no change) 01 = 8 bits 10 = 16bits 11 = 24 bits 4 Which bytes of R to update (hi to lo order byte)Each of the 4 bits represents 1 byte WriteEnable on R 10 TOTAL

Write

The Write process block is able to write to either the common VLIWOutput FIFO 79 or one of the two local Output FIFOs each cycle. Notethat since only 1 FIFO is written to in a given cycle, only one 16-bitvalue is output to all FIFOs, with the low 8 bits going to the VLIWOutput FIFO 79. The microcode controls which of the FIFOs gates in thevalue. The process of data selection can be seen in more detail in FIG.12. The source values Out₁ and Out₂ come from the Out block. They aresimply two registers. The microcode for Write takes the following form:

# Bits Description 2 00 = NOP 01 = Write VLIW Output FIFO 79 10 = Writelocal Output FIFO 1 11 = Write local Output FIFO 2 1 Select Output Value[Out₁ or Out₂] 3 Select part of Output Value to write (32 bits = 4 bytesABCD) 000 = 0D 001 = 0D 010 = 0B 011 = 0A 100 = CD 101 = BC 110 = AB 111= 0 6 TOTAL

Computational Blocks

Each ALU 188 has two computational process blocks, namely an Adder/Logicprocess block 204, and a Multiply/Interpolate process block 205. Inaddition there is a Barrel Shifter block to provide help to thesecomputational blocks. Registers from the Registers block 215 can be usedfor temporary storage during pipelined operations.

Barrel Shifter

The Barrel Shifter process block 206 is shown in more detail in FIG. 13and takes its input from the output of Adder/Logic orMultiply/Interpolate process blocks or the previous cycle's results fromthose blocks (ALU registers L and M). The 32 bits selected are barrelshifted an arbitrary number of bits in either direction (with signextension as necessary), and output to the ALU 188's S register 209. Themicrocode for the Barrel Shift process block is described in thefollowing table. Note that the interpretations of some bit patterns aredeliberately chosen to aid decoding.

# Bits Description 3 000 = NOP 001 = Shift Left (unsigned) 010 =Reserved 011 = Shift Left (signed) 100 = Shift right (unsigned, norounding) 101 = Shift right (unsigned, with rounding) 110 = Shift right(signed, no rounding) 111 = Shift right (signed, with rounding) 2 SelectInput to barrel shift: 00 = Multiply/Interpolate result 01 = M 10 =Adder/Logic result 11 = L 5 # bits to shift 1 Ceiling of 255 1 Floor of0 (signed data) 12 TOTAL

Adder/Logic 204

The Adder/Logic process block is shown in more detail in FIG. 14 and isdesigned for simple 32-bit addition/subtraction, comparisons, andlogical operations. In a single cycle a single addition, comparison, orlogical operation can be performed, with the result stored in the ALU188's L register 209. There are two primary operands, A and B, which areselected from either of the two crossbars or from the 4 constantregisters. One crossbar selection allows the results of the previouscycle's arithmetic operation to be used while the second provides accessto operands previously calculated by this or another ALU 188. The CPU isthe only unit that has write access to the four constants (K₁-K₄). Incases where an operation such as (A+B)×4 is desired, the direct outputfrom the adder can be used as input to the Barrel Shifter, and can thusbe shifted left 2 places without needing to be latched into the Lregister 209 first. The output from the adder can also be made availableto the multiply unit for a multiply-accumulate operation. The microcodefor the Adder/Logic process block is described in the following table.The interpretations of some bit patterns are deliberately chosen to aiddecoding. Microcode bit interpretation for Adder/Logic unit

# Bits Description 4 0000 = A + B (carry in = 0) 0001 = A + B (carry in= carry out of previous operation) 0010 = A + B + 1 (carry in = 1) 0011= A + 1 (increments A) 0100 = A − B − 1 (carry in = 0) 0101 = A − B(carry in = carry out of previous operation) 0110 = A − B (carry in = 1)0111 = A − 1 (decrements A) 1000 = NOP 1001 = ABS(A − B) 1010 = MIN(A,B) 1011 = MAX(A, B) 1100 = A AND B (both A & B can be inverted, seebelow) 1101 = A OR B (both A & B can be inverted, see below) 1110 = AXOR B (both A & B can be inverted, see below) 1111 = A (A can beinverted, see below) 1 If logical operation: 0 = A = A 1 = A = NOT(A) IfAdder operation: 0 = A is unsigned 1 = A is signed 1 If logicaloperation: 0 = B = B 1 = B = NOT(B) If Adder operation 0 = B is unsigned1 = B is signed 4 Select A [In₁, In₂, Out₁, Out₂, D₀, D₁, D₂, D₃, M, L,S, R, K₁, K₂, K₃, K₄] 4 Select B [In₁, In₂, Out₁, Out₂, D₀, D₁, D₂, D₃,M, L, S, R, K₁, K₂, K₃, K₄] 14 TOTAL

Multiply/Interpolate 205

The Multiply/Interpolate process block is shown in more detail in FIG.15 and is a set of four 8×8 interpolator units that are capable ofperforming four individual 8×8 interpolates per cycle, or can becombined to perform a single 16×16 multiply. This gives the possibilityto perform up to 4 linear interpolations, a single bi-linearinterpolation, or half of a tri-linear interpolation in a single cycle.The result of the interpolations or multiplication is stored in the ALU188's M register 209. There are two primary operands, A and B, which areselected from any of the general registers in the ALU 188 or from fourprogrammable constants internal to the Multiply/Interpolate processblock. Each interpolator block functions as a simple 8 bit interpolator[result=A+(B−A)f] or as a simple 8×8 multiply [result=A*B]. When theoperation is interpolation, A and B are treated as four 8 bit numbers A₀thru A₃ (A₀ is the low order byte), and B₀ thru B₃. Agen, Bgen, and Fgenare responsible for ordering the inputs to the Interpolate units so thatthey match the operation being performed. For example, to performbilinear interpolation, each of the 4 values must be multiplied by adifferent factor & the result summed, while a 16×16 bit multiplicationrequires the factors to be 0. The microcode for the Adder/Logic processblock is described in the following table. Note that the interpretationsof some bit patterns are deliberately chosen to aid decoding.

# Bits Description 4 0000 = (A₁₀ * B₁₀) + V 0001 = (A0 * B0) + (A1 *B1) + V 0010 = (A₁₀ * B₁₀) − V 0011 = V − (A₁₀ * B₁₀) 0100 = InterpolateA₀,B₀ by f₀ 0101 = Interpolate A₀,B₀ by f₀, A₁,B₁ by f₁ 0110 =Interpolate A₀,B₀ by f₀, A₁,B₁ by f₁, A₂, B₂ by f₂ 0111 = InterpolateA₀,B₀ by f₀, A₁,B₁ by f₁, A₂,B₂ by f₂, A₃,B₃ by f₃ 1000 = Interpolate 16bits stage 1 [M = A₁₀ * f₁₀] 1001 = Interpolate 16 bits stage 2 [M = M +(A₁₀ * f₁₀)] 1010 = Tri-linear interpolate A by f stage 1 [M = A₀f₀ +A₁f₁ + A₂f₂ + A₃f₃] 1011 = Tri-linear interpolate A by f stage 2 [M =M + A₀f₀ + A₁f₁ + A₂f₂ + A₃f₃] 1100 = Bi-linear interpolate A by f stage1 [M = A₀f₀ + A₁f₁] 1101 = Bi-linear interpolate A by f stage 2 [M = M +A₀f₀ + A₁f₁] 1110 = Bi-linear interpolate A by f complete [M = A₀f₀ +A₁f₁ + A₂f₂ + A₃f₃] 1111 = NOP 4 Select A [In₁, In₂, Out₁, Out₂, D₀, D₁,D₂, D₃, M, L, S, R, K₁, K₂, K₃, K₄] 4 Select B [In₁, In₂, Out₁, Out₂,D₀, D₁, D₂, D₃, M, L, S, R, K₁, K₂, K₃, K₄] If Mult: 4 Select V [In₁,In₂,Out₁, Out₂,D₀, D₁, D₂, D₃, K₁, K₂, K₃, K₄, Adder result, M, 0, 1] 1Treat A as signed 1 Treat B as signed 1 Treat V as signed If Interp: 4Select basis for f [In₁, In₂,Out₁, Out₂,D₀, D₁, D₂, D₃, K₁, K₂, K₃, K₄,X, X, X, X] 1 Select interpolation f generation from P₁ or P₂ P_(n) isinterpreted as # fractional bits in f If P_(n) = 0, f is range 0 . . .255 representing 0 . . . 1 2 Reserved 19  TOTAL

The same 4 bits are used for the selection of V and f, although the last4 options for V don't generally make sense as f values. Interpolatingwith a factor of 1 or 0 is pointless, and the previous multiplication orcurrent result is unlikely to be a meaningful value for f.

I/O Address Generators 189, 190

The I/O Address Generators are shown in more detail in FIG. 16. A VLIWprocess does not access DRAM directly. Access is via 2 I/O AddressGenerators 189, 190, each with its own Input and Output FIFO. A PU e.g178 reads data from one of two local Input FIFOs, and writes data to oneof two local Output FIFOs. Each I/O Address Generator is responsible forreading data from DRAM and placing it into its Input FIFO, where it canbe read by the PU e.g 178, and is responsible for taking the data fromits Output FIFO (placed there by the PU e.g 178) and writing it to DRAM.The I/O Address Generator is a state machine responsible for generatingaddresses and control for data retrieval and storage in DRAM via theData cache 76. It is customizable under CPU software control, but cannotbe microcoded. The address generator produces addresses in two broadcategories:

-   -   Image Iterators, used to iterate (reading, writing or both)        through pixels of an image in a variety of ways    -   Table I/O, used to randomly access pixels in images, data in        tables, and to simulate FIFOs in DRAM

Each of the I/O Address Generators 189, 190 has its own bus connectionto the Data cache 76, making 2 bus connections per PU e.g 178, and atotal of 8 buses over the entire VLIW Vector Processor 74. The Datacache 76 is able to service 4 of the maximum 8 requests from the 4 PUse.g 178 each cycle. The Input and Output FIFOs are 8 entry deep 16-bitwide FIFOs. The various types of address generation (Image Iterators andTable I/O) are described in the subsequent sections.

Registers

The I/O Address Generator has a set of registers for that are used tocontrol address generation. The addressing mode also determines how thedata is formatted and sent into the local Input FIFO, and how data isinterpreted from the local Output FIFO. The CPU is able to access theregisters of the I/O Address Generator via the low speed bus. The firstset of registers define the housekeeping parameters for the I/OGenerator:

Register Name # bits Description Reset 0 A write to this register haltsany operations, and writes 0s to all the data registers of the I/OGenerator. The input and output FIFOs are not cleared. Go 0 A write tothis register restarts the counters according to the current setup. Forexample, if the I/O Generator is a Read Iterator, and the Iterator iscurrently halfway through the image, a write to Go will cause thereading to begin at the start of the image again. While the I/OGenerator is performing, the Active bit of the Status register will beset. Halt 0 A write to this register stops any current activity andclears the Active bit of the Status register. If the Active bit isalready cleared, writing to this register has no effect. Continue 0 Awrite to this register continues the I/O Generator from the currentsetup. Counters are not reset, and FIFOs are not cleared. A write tothis register while the I/O Generator is active has no effect.ClearFIFOsOnGo 1 0 = Don't clear FIFOs on a write to the Go bit. 1 = Doclear FIFOs on a write to the Go bit. Status 8 Status flags

The Status Register has the Following Values

Register Name # bits Description Active 1 0 = Currently inactive 1 =Currently active Reserved 7 —

Caching

Several registers are used to control the caching mechanism, specifyingwhich cache group to use for inputs, outputs etc. See the section on theData cache 76 for more information about cache groups.

Register Name # bits Description CacheGroup1 4 Defines cache group toread data from CacheGroup2 4 Defines which cache group to write data to,and in the case of the ImagePyramidLookup I/O mode, defines the cache touse for reading the Level Information Table.

Image Iterators=Sequential Automatic Access to Pixels

The primary image pixel access method for software and hardwarealgorithms is via Image Iterators. Image iterators perform all of theaddressing and access to the caches of the pixels within an imagechannel and read, write or read & write pixels for their client. ReadIterators read pixels in a specific order for their clients, and WriteIterators write pixels in a specific order for their clients. Clients ofIterators read pixels from the local Input FIFO or write pixels via thelocal Output FIFO. Read Image Iterators read through an image in aspecific order, placing the pixel data into the local Input FIFO. Everytime a client reads a pixel from the Input FIFO, the Read Iteratorplaces the next pixel from the image (via the Data cache 76) into theFIFO.

Write Image Iterators write pixels in a specific order to write out theentire image. Clients write pixels to the Output FIFO that is in turnread by the Write Image Iterator and written to DRAM via the Data cache76.

Typically a VLIW process will have its input tied to a Read Iterator,and output tied to a corresponding Write Iterator. From the PU e.g 178microcode program's perspective, the FIFO is the effective interface toDRAM. The actual method of carrying out the storage (apart from thelogical ordering of the data) is not of concern. Although the FIFO isperceived to be effectively unlimited in length, in practice the FIFO isof limited length, and there can be delays storing and retrieving data,especially if several memory accesses are competing. A variety of ImageIterators exist to cope with the most common addressing requirements ofimage processing algorithms. In most cases there is a correspondingWrite Iterator for each Read Iterator. The different Iterators arelisted in the following table:

Read Iterators Write Iterators Sequential Read Sequential Write Box Read— Vertical Strip Read Vertical Strip Write

The 4 Bit Address Mode Register is Used to Determine the Iterator Type:

Bit # Address Mode 3 0 = This addressing mode is an Iterator 2 to 0Iterator Mode 001 = Sequential Iterator 010 = Box [read only] 100 =Vertical Strip remaining bit patterns are reserved

The Access Specific Registers are Used as Follows:

Register Name LocalName Description AccessSpecific₁ Flags Flags used forreading and writing AccessSpecific₂ XBoxSize Determines the size in X ofBox Read. Valid values are 3, 5, and 7. AccessSpecific₃ YBoxSizeDetermines the size in Y of Box Read. Valid values are 3, 5, and 7.AccessSpecific₄ BoxOffset Offset between one pixel center and the nextduring a Box Read only. Usual value is 1, but other useful valuesinclude 2, 4, 8 . . . See Box Read for more details.

The Flags register (AccessSpecific₁) contains a number of flags used todetermine factors affecting the reading and writing of data. The Flagsregister has the following composition:

Label #bits Description ReadEnable 1 Read data from DRAM WriteEnable 1Write data to DRAM [not valid for Box mode] PassX 1 Pass X (pixel)ordinate back to Input FIFO PassY 1 Pass Y (row) ordinate back to InputFIFO Loop 1 0 = Do not loop through data 1 = Loop through data Reserved11 Must be 0

Notes on ReadEnable and WriteEnable:

-   -   When ReadEnable is set, the I/O Address Generator acts as a Read        Iterator, and therefore reads the image in a particular order,        placing the pixels into the Input FIFO.    -   When WriteEnable is set, the I/O Address Generator acts as a        Write Iterator, and therefore writes the image in a particular        order, taking the pixels from the Output FIFO.    -   When both ReadEnable and WriteEnable are set, the I/O Address        Generator acts as a Read Iterator and as a Write Iterator,        reading pixels into the Input FIFO, and writing pixels from the        Output FIFO. Pixels are only written after they have been        read—i.e. the Write Iterator will never go faster than the Read        Iterator. Whenever this mode is used, care should be taken to        ensure balance between in and out processing by the VLIW        microcode. Note that separate cache groups can be specified on        reads and writes by loading different values in CacheGroup 1 and        CacheGroup2.

Notes on PassX and PassY:

-   -   If PassX and PassY are both set, the Y ordinate is placed into        the Input FIFO before the X ordinate.    -   PassX and PassY are only intended to be set when the ReadEnable        bit is clear. Instead of passing the ordinates to the address        generator, the ordinates are placed directly into the Input        FIFO. The ordinates advance as they are removed from the FIFO.    -   If WriteEnable bit is set, the VLIW program must ensure that it        balances reads of ordinates from the Input FIFO with writes to        the Output FIFO, as writes will only occur up to the ordinates        (see note on ReadEnable and WriteEnable above).

Notes on Loop:

-   -   If the Loop bit is set, reads will recommence at [StartPixel,        StartRow] once it has reached [EndPixel, EndRow]. This is ideal        for processing a structure such a convolution kernel or a dither        cell matrix, where the data must be read repeatedly.    -   Looping with ReadEnable and WriteEnable set can be useful in an        environment keeping a single line history, but only where it is        useful to have reading occur before writing. For a FIFO effect        (where writing occurs before reading in a length constrained        fashion), use an appropriate Table I/O addressing mode instead        of an Image Iterator.    -   Looping with only WriteEnable set creates a written window of        the last N pixels. This can be used with an asynchronous process        that reads the data from the window. The Artcard Reading        algorithm makes use of this mode.

Sequential Read and Write Iterators

FIG. 17 illustrates the pixel data format. The simplest Image Iteratorsare the Sequential Read Iterator and corresponding Sequential WriteIterator. The Sequential Read Iterator presents the pixels from achannel one line at a time from top to bottom, and within a line, pixelsare presented left to right. The padding bytes are not presented to theclient. It is most useful for algorithms that must perform some processon each pixel from an image but don't care about the order of the pixelsbeing processed, or want the data specifically in this order.Complementing the Sequential Read Iterator is the Sequential WriteIterator. Clients write pixels to the Output FIFO. A Sequential WriteIterator subsequently writes out a valid image using appropriate cachingand appropriate padding bytes. Each Sequential Iterator requires accessto 2 cache lines. When reading, while 32 pixels are presented from onecache line, the other cache line can be loaded from memory. Whenwriting, while 32 pixels are being filled up in one cache line, theother can be being written to memory. A process that performs anoperation on each pixel of an image independently would typically use aSequential Read Iterator to obtain pixels, and a Sequential WriteIterator to write the new pixel values to their corresponding locationswithin the destination image. Such a process is shown in FIG. 18.

In most cases, the source and destination images are different, and arerepresented by 2 I/O Address Generators 189, 190. However it can bevalid to have the source image and destination image to be the same,since a given input pixel is not read more than once. In that case, thenthe same Iterator can be used for both input and output, with both theReadEnable and WriteEnable registers set appropriately. For maximumefficiency, 2 different cache groups should be used—one for reading andthe other for writing. If data is being created by a VLIW process to bewritten via a Sequential Write Iterator, the PassX and PassY flags canbe used to generate coordinates that are then passed down the InputFIFO. The VLIW process can use these coordinates and create the outputdata appropriately.

Box Read Iterator

The Box Read Iterator is used to present pixels in an order most usefulfor performing operations such as general-purpose filters and convolve.The Iterator presents pixel values in a square box around thesequentially read pixels. The box is limited to being 1, 3, 5, or 7pixels wide in X and Y (set XBoxSize and YBoxSize—they must be the samevalue or 1 in one dimension and 3, 5, or 7 in the other). The process isshown in FIG. 19:

BoxOffset: This special purpose register is used to determine asub-sampling in terms of which input pixels will be used as the centerof the box. The usual value is 1, which means that each pixel is used asthe center of the box. The value “2” would be useful in scaling an imagedown by 4:1 as in the case of building an image pyramid. Using pixeladdresses from the previous diagram, the box would be centered on pixel0, then 2, 8, and 10. The Box Read Iterator requires access to a maximumof 14 (2×7) cache lines. While pixels are presented from one set of 7lines, the other cache lines can be loaded from memory.

Box Write Iterator

There is no corresponding Box Write Iterator, since the duplication ofpixels is only required on input. A process that uses the Box ReadIterator for input would most likely use the Sequential Write Iteratorfor output since they are in sync. A good example is the convolver,where N input pixels are read to calculate 1 output pixel. The processflow is as illustrated in FIG. 20. The source and destination imagesshould not occupy the same memory when using a Box Read Iterator, assubsequent lines of an image require the original (not newly calculated)values.

Vertical-Strip Read and Write Iterators

In some instances it is necessary to write an image in output pixelorder, but there is no knowledge about the direction of coherence ininput pixels in relation to output pixels. An example of this isrotation. If an image is rotated 90 degrees, and we process the outputpixels horizontally, there is a complete loss of cache coherence. On theother hand, if we process the output image one cache line's width ofpixels at a time and then advance to the next line (rather than advanceto the next cache-line's worth of pixels on the same line), we will gaincache coherence for our input image pixels. It can also be the case thatthere is known ‘block’ coherence in the input pixels (such as colorcoherence), in which case the read governs the processing order, and thewrite, to be synchronized, must follow the same pixel order.

The order of pixels presented as input (Vertical-Strip Read), orexpected for output (Vertical-Strip Write) is the same. The order ispixels 0 to 31 from line 0, then pixels 0 to 31 of line 1 etc for alllines of the image, then pixels 32 to 63 of line 0, pixels 32 to 63 ofline 1 etc. In the final vertical strip there may not be exactly 32pixels wide. In this case only the actual pixels in the image arepresented or expected as input. This process is illustrated in FIG. 21.

process that requires only a Vertical-Strip Write Iterator willtypically have a way of mapping input pixel coordinates given an outputpixel coordinate. It would access the input image pixels according tothis mapping, and coherence is determined by having sufficient cachelines on the ‘random-access’ reader for the input image. The coordinateswill typically be generated by setting the PassX and PassY flags on theVerticalStripWrite Iterator, as shown in the process overviewillustrated in FIG. 22.

It is not meaningful to pair a Write Iterator with a Sequential ReadIterator or a Box read Iterator, but a Vertical-Strip Write Iteratordoes give significant improvements in performance when there is a nontrivial mapping between input and output coordinates.

It can be meaningful to pair a Vertical Strip Read Iterator and VerticalStrip Write Iterator. In this case it is possible to assign both to asingle ALU 188 if input and output images are the same. If coordinatesare required, a further Iterator must be used with PassX and PassY flagsset. The Vertical Strip Read/Write Iterator presents pixels to the InputFIFO, and accepts output pixels from the Output FIFO. Appropriatepadding bytes will be inserted on the write. Input and output require aminimum of 2 cache lines each for good performance.

Table I/O Addressing Modes

It is often necessary to lookup values in a table (such as an image).Table I/O addressing modes provide this functionality, requiring theclient to place the index/es into the Output FIFO. The I/O AddressGenerator then processes the index/es, looks up the data appropriately,and returns the looked-up values in the Input FIFO for subsequentprocessing by the VLIW client.

1D, 2D and 3D tables are supported, with particular modes targeted atinterpolation. To reduce complexity on the VLIW client side, the indexvalues are treated as fixed-point numbers, with AccessSpecific registersdefining the fixed point and therefore which bits should be treated asthe integer portion of the index. Data formats are restricted forms ofthe general Image Characteristics in that the PixelOffset register isignored, the data is assumed to be contiguous within a row, and can onlybe 8 or 16 bits (1 or 2 bytes) per data element. The 4 bit Address ModeRegister is used to determine the I/O type:

Bit # Address Mode 3 1 = This addressing mode is Table I/O 2 to 0 000 =1D Direct Lookup 001 = 1D Interpolate (linear) 010 = DRAM FIFO 011 =Reserved 100 = 2D Interpolate (bi-linear) 101 = Reserved 110 = 3DInterpolate (tri-linear) 111 = Image Pyramid Lookup

The access specific registers are:

Register Name LocalName #bits Description AccessSpecific₁ Flags 8General flags for reading and writing. See below for more information.AccessSpecific₂ FractX 8 Number of fractional bits in X indexAccessSpecific₃ FractY 8 Number of fractional bits in Y indexAccessSpecific₄ FractZ 8 Number of fractional bits in Z (low 8 bits/nextindex 12 or 4 bits)) ZOffset 12 or See below 24

FractX, FractY, and FractZ are used to generate addresses based onindexes, and interpret the format of the index in terms of significantbits and integer/fractional components. The various parameters are onlydefined as required by the number of dimensions in the table beingindexed. A 1D table only needs FractX, a 2D table requires FractX andFractY. Each Fract_value consists of the number of fractional bits inthe corresponding index. For example, an X index may be in the format5:3. This would indicate 5 bits of integer, and 3 bits of fraction.FractX would therefore be set to 3. A simple 1D lookup could have theformat 8:0, i.e. no fractional component at all. FractX would thereforebe 0. ZOffset is only required for 3D lookup and takes on two differentinterpretations. It is described more fully in the 3D-table lookupsection. The Flags register (AccessSpecific₁) contains a number of flagsused to determine factors affecting the reading (and in one case,writing) of data. The Flags register has the following composition:

Label #bits Description ReadEnable 1 Read data from DRAM WriteEnable 1Write data to DRAM [only valid for 1D direct lookup] DataSize 1 0 = 8bit data 1 = 16 bit data Reserved 5 Must be 0

With the exception of the 1D Direct Lookup and DRAM FIFO, all Table I/Omodes only support reading, and not writing. Therefore the ReadEnablebit will be set and the WriteEnable bit will be clear for all I/O modesother than these two modes. The 1D Direct Lookup supports 3 modes:

-   -   Read only, where the ReadEnable bit is set and the WriteEnable        bit is clear    -   Write only, where the ReadEnable bit is clear and the        WriteEnable bit is clear    -   Read-Modify-Write, where both ReadEnable and the WriteEnable        bits are set

The different modes are described in the 1D Direct Lookup section below.The DRAM FIFO mode supports only 1 mode:

-   -   Write-Read mode, where both ReadEnable and the WriteEnable bits        are set

This mode is described in the DRAM FIFO section below. The DataSize flagdetermines whether the size of each data elements of the table is 8 or16 bits. Only the two data sizes are supported. 32 bit elements can becreated in either of 2 ways depending on the requirements of theprocess:

-   -   Reading from 2 16-bit tables simultaneously and combining the        result. This is convenient if timing is an issue, but has the        disadvantage of consuming 2 I/O Address Generators 189, 190, and        each 32-bit element is not readable by the CPU as a 32-bit        entity.    -   Reading from a 16-bit table twice and combining the result. This        is convenient since only 1 lookup is used, although different        indexes must be generated and passed into the lookup.

1 Dimensional Structures Direct Lookup

A direct lookup is a simple indexing into a 1 dimensional lookup table.Clients can choose between 3 access modes by setting appropriate bits inthe Flags register:

-   -   Read only    -   Write only    -   Read-Modify-Write

Read Only

A client passes the fixed-point index X into the Output FIFO, and the 8or 16-bit value at Table[Int(X)] is returned in the Input FIFO. Thefractional component of the index is completely ignored. If the index isout of bounds, the DuplicateEdge flag determines whether the edge pixelor ConstantPixel is returned. The address generation is straightforward:

-   -   If DataSize indicates 8 bits, X is barrel-shifted right FractX        bits, and the result is added to the table's base address        ImageStart.    -   If DataSize indicates 16 bits, X is barrel-shifted right FractX        bits, and the result shifted left 1 bit (bit0 becomes 0) is        added to the table's base address ImageStart.

The 8 or 16-bit data value at the resultant address is placed into theInput FIFO. Address generation takes 1 cycle, and transferring therequested data from the cache to the Output FIFO also takes 1 cycle(assuming a cache hit). For example, assume we are looking up values ina 256-entry table, where each entry is 16 bits, and the index is a 12bit fixed-point format of 8:4. FractX should be 4, and DataSize 1. Whenan index is passed to the lookup, we shift right 4 bits, then add theresult shifted left 1 bit to ImageStart.

Write Only

A client passes the fixed-point index X into the Output FIFO followed bythe 8 or 16-bit value that is to be written to the specified location inthe table. A complete transfer takes a minimum of 2 cycles. 1 cycle foraddress generation, and 1 cycle to transfer the data from the FIFO toDRAM. There can be an arbitrary number of cycles between a VLIW processplacing the index into the FIFO and placing the value to be written intothe FIFO. Address generation occurs in the same way as Read Only mode,but instead of the data being read from the address, the data from theOutput FIFO is written to the address. If the address is outside thetable range, the data is removed from the FIFO but not written to DRAM.

Read-Modify-Write

A client passes the fixed-point index X into the Output FIFO, and the 8or 16-bit value at Table[Int(X)] is returned in the Input FIFO. The nextvalue placed into the Output FIFO is then written to Table[Int(X)],replacing the value that had been returned earlier. The generalprocessing loop then, is that a process reads from a location, modifiesthe value, and writes it back. The overall time is 4 cycles:

-   -   Generate address from index    -   Return value from table    -   Modify value in some way    -   Write it back to the table

There is no specific read/write mode where a client passes in a flagsaying “read from X” or “write to X”. Clients can simulate a “read fromX” by writing the original value, and a “write to X” by simply ignoringthe returned value. However such use of the mode is not encouraged sinceeach action consumes a minimum of 3 cycles (the modify is not required)and 2 data accesses instead of 1 access as provided by the specific Readand Write modes.

Interpolate Table

This is the same as a Direct Lookup in Read mode except that two valuesare returned for a given fixed-point index X instead of one. The valuesreturned are Table[Int(X)], and Table[Int(X)+1]. If either index is outof bounds the DuplicateEdge flag determines whether the edge pixel orConstantPixel is returned. Address generation is the same as DirectLookup, with the exception that the second address is simply Address1+1or 2 depending on 8 or 16 bit data. Transferring the requested data tothe Output FIFO takes 2 cycles (assuming a cache hit), although two8-bit values may actually be returned from the cache to the AddressGenerator in a single 16-bit fetch.

DRAM FIFO

A special case of a read/write 1D table is a DRAM FIFO. It is oftennecessary to have a simulated FIFO of a given length using DRAM andassociated caches. With a DRAM FIFO, clients do not index explicitlyinto the table, but write to the Output FIFO as if it was one end of aFIFO and read from the Input FIFO as if it was the other end of the samelogical FIFO. 2 counters keep track of input and output positions in thesimulated FIFO, and cache to DRAM as needed. Clients need to set bothReadEnable and WriteEnable bits in the Flags register.

An example use of a DRAM FIFO is keeping a single line history of somevalue. The initial history is written before processing begins. As thegeneral process goes through a line, the previous line's value isretrieved from the FIFO, and this line's value is placed into the FIFO(this line will be the previous line when we process the next line). Solong as input and outputs match each other on average, the Output FIFOshould always be full. Consequently there is effectively no access delayfor this kind of FIFO (unless the total FIFO length is very small—say 3or 4 bytes, but that would defeat the purpose of the FIFO).

2 Dimensional Tables Direct Lookup

A 2 dimensional direct lookup is not supported. Since all cases of 2Dlookups are expected to be accessed for bi-linear interpolation, aspecial bi-linear lookup has been implemented.

Bi-Linear lookup

This kind of lookup is necessary for bi-linear interpolation of datafrom a 2D table. Given fixed-point X and Y coordinates (placed into theOutput FIFO in the order Y, X), 4 values are returned after lookup. Thevalues (in order) are:

-   -   Table[Int(X), Int(Y)]    -   Table[Int(X)+1, Int(Y)]    -   Table[Int(X), Int(Y)+1]    -   Table[Int(X)+1, Int(Y)+1]

The order of values returned gives the best cache coherence. If the datais 8-bit, 2 values are returned each cycle over 2 cycles with the loworder byte being the first data element. If the data is 16-bit, the 4values are returned in 4 cycles, 1 entry per cycle. Address generationtakes 2 cycles. The first cycle has the index (Y) barrel-shifted rightFractY bits being multiplied by RowOffset, with the result added toImageStart. The second cycle shifts the X index right by FractX bits,and then either the result (in the case of 8 bit data) or the resultshifted left 1 bit (in the case of 16 bit data) is added to the resultfrom the first cycle. This gives us address Adr=address of Table[Int(X),Int(Y)]:

-   -   Adr=ImageS tart    -   +ShiftRight(Y, FractY)* RowOffset)    -   +ShiftRight(X, FractX)

We keep a copy of Adr in AdrOld for use fetching subsequent entries.

-   -   If the data is 8 bits, the timing is 2 cycles of address        generation, followed by 2 cycles of data being returned (2 table        entries per cycle).    -   If the data is 16 bits, the timing is 2 cycles of address        generation, followed by 4 cycles of data being returned (1 entry        per cycle)

The following 2 tables show the method of address calculation for 8 and16 bit data sizes:

Cycle Calculation while fetching 2 × 8-bit data entries from Adr 1 Adr =Adr + RowOffset 2 <preparing next lookup>

Cycle Calculation while fetching 1 × 16-bit data entry from Adr 1 Adr =Adr + 2 2 Adr = AdrOld + RowOffset 3 Adr = Adr + 2 4 <preparing nextlookup>

In both cases, the first cycle of address generation can overlap theinsertion of the X index into the FIFO, so the effective timing can beas low as 1 cycle for address generation, and 4 cycles of return data.If the generation of indexes is 2 steps ahead of the results, then thereis no effective address generation time, and the data is simply producedat the appropriate rate (2 or 4 cycles per set).

3 Dimensional Lookup Direct Lookup

Since all cases of 2D lookups are expected to be accessed for tri-linearinterpolation, two special tri-linear lookups have been implemented. Thefirst is a straightforward lookup table, while the second is fortri-linear interpolation from an Image Pyramid.

Tri-Linear Lookup

This type of lookup is useful for 3D tables of data, such as colorconversion tables. The standard image parameters define a single XYplane of the data—i.e. each plane consists of ImageHeight rows, each rowcontaining RowOffset bytes. In most circumstances, assuming contiguousplanes, one XY plane will be ImageHeight×RowOffset bytes after another.Rather than assume or calculate this offset, the software via the CPUmust provide it in the form of a 12-bit ZOffset register. In this formof lookup, given 3 fixed-point indexes in the order Z, Y, X, 8 valuesare returned in order from the lookup table:

-   -   Table[Int(X), Int(Y), Int(Z)]    -   Table[Int(X)+1, Int(Y), Int(Z)]    -   Table[Int(X), Int(Y)+1, Int(Z)]    -   Table[Int(X)+1, Int(Y)+1, Int(Z)]    -   Table[Int(X), Int(Y), Int(Z)+1]    -   Table[Int(X)+1, Int(Y), Int(Z)+1]    -   Table[Int(X), Int(Y)+1, Int(Z)+1]    -   Table[Int(X)+1, Int(Y)+1, Int(Z)+1]

The order of values returned gives the best cache coherence. If the datais 8-bit, 2 values are returned each cycle over 4 cycles with the loworder byte being the first data element. If the data is 16-bit, the 4values are returned in 8 cycles, 1 entry per cycle. Address generationtakes 3 cycles. The first cycle has the index (Z) barrel-shifted rightFractZ bits being multiplied by the 12-bit ZOffset and added toImageStart. The second cycle has the index (Y) barrel-shifted rightFractY bits being multiplied by RowOffset, with the result added to theresult of the previous cycle. The second cycle shifts the X index rightby FractX bits, and then either the result (in the case of 8 bit data)or the result shifted left 1 bit (in the case of 16 bit data) is addedto the result from the second cycle. This gives us address Adr=addressof Table[Int(X), Int(Y), Int(Z)]:

-   -   Adr=ImageStart    -   +(ShiftRight(Z, FractZ) * ZOffset)    -   +(ShiftRight(Y, FractY)* RowOffset)    -   +ShiftRight(X, FractX)

We keep a copy of Adr in AdrOld for use fetching subsequent entries.

-   -   If the data is 8 bits, the timing is 2 cycles of address        generation, followed by 2 cycles of data being returned (2 table        entries per cycle).    -   If the data is 16 bits, the timing is 2 cycles of address        generation, followed by 4 cycles of data being returned (1 entry        per cycle)

The following 2 tables show the method of address calculation for 8 and16 bit data sizes:

Cycle Calculation while fetching 2 × 8-bit data entries from Adr 1 Adr =Adr + RowOffset 2 Adr = AdrOld + ZOffset 3 Adr = Adr + RowOffset 4<preparing next lookup>

Cycle Calculation while fetching 1 × 16-bit data entries from Adr 1 Adr= Adr + 2 2 Adr = AdrOld + RowOffset 3 Adr = Adr + 2 4 Adr, AdrOld =AdrOld + Zoffset 5 Adr = Adr + 2 6 Adr = AdrOld + RowOffset 7 Adr =Adr + 2 8 <preparing next lookup>

In both cases, the cycles of address generation can overlap theinsertion of the indexes into the FIFO, so the effective timing for asingle one-off lookup can be as low as 1 cycle for address generation,and 4 cycles of return data. If the generation of indexes is 2 stepsahead of the results, then there is no effective address generationtime, and the data is simply produced at the appropriate rate (4 or 8cycles per set).

Image Pyramid Lookup

During brushing, tiling, and warping it is necessary to compute theaverage color of a particular area in an image. Rather than calculatethe value for each area given, these functions make use of an imagepyramid. The description and construction of an image pyramid isdetailed in the section on Internal Image Formats in the DRAM interface81 chapter of this document. This section is concerned with a method ofaddressing given pixels in the pyramid in terms of 3 fixed-point indexesordered: level (Z), Y, and X. Note that Image Pyramid lookup assumes 8bit data entries, so the DataSize flag is completely ignored. Afterspecification of Z, Y, and X, the following 8 pixels are returned viathe Input FIFO:

-   -   The pixel at [Int(X), Int(Y)], level Int(Z)    -   The pixel at [Int(X)+1, Int(Y)], level Int(Z)    -   The pixel at [Int(X), Int(Y)+1], level Int(Z)    -   The pixel at [Int(X)+1, Int(Y)+1], level Int(Z)    -   The pixel at [Int(X), Int(Y)], level Int(Z)+1    -   The pixel at [Int(X)+1, Int(Y)], level Int(Z)+1    -   The pixel at [Int(X), Int(Y)+1], level Int(Z)+1    -   The pixel at [Int(X)+1, Int(Y)+1], level Int(Z)+1

The 8 pixels are returned as 4×16 bit entries, with X and X+1 entriescombined hi/lo. For example, if the scaled (X, Y) coordinate was (10.4,12.7) the first 4 pixels returned would be: (10, 12), (11, 12), (10, 13)and (11, 13). When a coordinate is outside the valid range, clients havethe choice of edge pixel duplication or returning of a constant colorvalue via the DuplicateEdgePixels and ConstantPixel registers (only thelow 8 bits are used). When the Image Pyramid has been constructed, thereis a simple mapping from level 0 coordinates to level Z coordinates. Themethod is simply to shift the X or Y coordinate right by Z bits. Thismust be done in addition to the number of bits already shifted toretrieve the integer portion of the coordinate (i.e. shifting rightFractX and FractY bits for X and Y ordinates respectively). To find theImageStart and RowOffset value for a given level of the image pyramid,the 24-bit ZOffset register is used as a pointer to a Level InformationTable. The table is an array of records, each representing a given levelof the pyramid, ordered by level number. Each record consists of a16-bit offset ZOffset from ImageStart to that level of the pyramid(64-byte aligned address as lower 6 bits of the offset are not present),and a 12 bit ZRowOffset for that level. Element 0 of the table wouldcontain a ZOffset of 0, and a ZRowOffset equal to the general registerRowOffset, as it simply points to the full sized image. The ZOffsetvalue at element N of the table should be added to ImageStart to yieldthe effective ImageStart of level N of the image pyramid. The RowOffsetvalue in element N of the table contains the RowOffset value for levelN. The software running on the CPU must set up the table appropriatelybefore using this addressing mode. The actual address generation isoutlined here in a cycle by cycle description:

Load From Cycle Register Address Other Operations 0 — — ZAdr =ShiftRight(Z, FractZ) + ZOffset ZInt = ShiftRight(Z, FractZ) 1 ZOffsetZadr ZAdr += 2 YInt = ShiftRight(Y, FractY) 2 ZRowOffset ZAdr ZAdr += 2YInt = ShiftRight(YInt, ZInt) Adr = ZOffset + ImageStart 3 ZOffset ZAdrZAdr += 2 Adr += ZrowOffset * YInt XInt = ShiftRight(X, FractX) 4 ZAdrZAdr Adr += ShiftRight(XInt, ZInt) ZOffset += ShiftRight(XInt, 1) 5 FIFOAdr Adr += ZrowOffset ZOffset += ImageStart 6 FIFO Adr Adr = (ZAdr *ShiftRight(Yint, 1)) + ZOffset 7 FIFO Adr Adr += Zadr 8 FIFO Adr <Cycle0 for next retrieval>

The address generation as described can be achieved using a singleBarrel Shifter, 2 adders, and a single 16×16 multiply/add unit yielding24 bits. Although some cycles have 2 shifts, they are either the sameshift value (i.e. the output of the Barrel Shifter is used two times) orthe shift is 1 bit, and can be hard wired. The following internalregisters are required: ZAdr, Adr, ZInt, YInt, XInt, ZRowOffset, andZlmageStart. The _Int registers only need to be 8 bits maximum, whilethe others can be up to 24 bits. Since this access method only readsfrom, and does not write to image pyramids, the CacheGroup2 is used tolookup the Image Pyramid Address Table (via ZAdr). CacheGroup1 is usedfor lookups to the image pyramid itself (via Adr). The address table isaround 22 entries (depending on original image size), each of 4 bytes.Therefore 3 or 4 cache lines should be allocated to CacheGroup2, whileas many cache lines as possible should be allocated to CacheGroup1. Thetiming is 8 cycles for returning a set of data, assuming that Cycle 8and Cycle 0 overlap in operation—i.e. the next request's Cycle 0 occursduring Cycle 8. This is acceptable since Cycle 0 has no memory access,and Cycle 8 has no specific operations.

Generation of Coordinates Using VLIW Vector Processor 74

Some functions that are linked to Write Iterators require the X and/or Ycoordinates of the current pixel being processed in part of theprocessing pipeline. Particular processing may also need to take placeat the end of each row, or column being processed. In most cases, thePassX and PassY flags should be sufficient to completely generate allcoordinates. However, if there are special requirements, the followingfunctions can be used. The calculation can be spread over a number ofALUs, for a single cycle generation, or be in a single ALU 188 for amulti-cycle generation.

Generate Sequential [X, Y]

When a process is processing pixels in sequential order according to theSequential Read Iterator (or generating pixels and writing them out to aSequential Write Iterator), the following process can be used togenerate X, Y coordinates instead of PassX/PassY flags as shown in FIG.23.

The coordinate generator counts up to ImageWidth in the X ordinate, andonce per ImageWidth pixels increments the Y ordinate. The actual processis illustrated in FIG. 24, where the following constants are set bysoftware:

Constant Value K₁ ImageWidth K₂ ImageHeight (optional)

The following registers are used to hold temporary variables:

Variable Value Reg₁ X (starts at 0 each line) Reg₂ Y (starts at 0)

The requirements are summarized as follows:

Requirements *+ + R K LU Iterators General 0 ¾ 2 ½ 0 0 TOTAL 0 ¾ 2 ½ 0 0

Generate Vertical Strip [X, Y]

When a process is processing pixels in order to write them to a VerticalStrip Write Iterator, and for some reason cannot use the PassX/PassYflags, the process as illustrated in FIG. 25 can be used to generate X,Y coordinates. The coordinate generator simply counts up to ImageWidthin the X ordinate, and once per ImageWidth pixels increments the Yordinate. The actual process is illustrated in FIG. 26, where thefollowing constants are set by software:

Constant Value K₁ 32 K₂ ImageWidth K₃ ImageHeight

The following registers are used to hold temporary variables:

Variable Value Reg₁ StartX (starts at 0, and is incremented by 32 onceper vertical strip) Reg₂ X Reg₃ EndX (starts at 32 and is incremented by32 to a maximum of ImageWidth) once per vertical strip) Reg₄ Y

The requirements are summarized as follows:

Requirements *+ + R K LU Iterators General 0 4 4 3 0 0 TOTAL 0 4 4 3 0 0

The calculations that occur once per vertical strip (2 additions, one ofwhich has an associated MIN) are not included in the general timingstatistics because they are not really part of the per pixel timing.However they do need to be taken into account for the programming of themicrocode for the particular function.

Image Sensor Interface (ISI 83)

The Image Sensor Interface (ISI 83) takes data from the CMOS ImageSensor and makes it available for storage in DRAM. The image sensor hasan aspect ratio of 3:2, with a typical resolution of 750×500 samples,yielding 375K (8 bits per pixel). Each 2×2 pixel block has theconfiguration as shown in FIG. 27. The ISI 83 is a state machine thatsends control information to the Image Sensor, including frame syncpulses and pixel clock pulses in order to read the image. Pixels areread from the image sensor and placed into the VLIW Input FIFO 78. TheVLIW is then able to process and/or store the pixels. This isillustrated further in FIG. 28. The ISI 83 is used in conjunction with aVLIW program that stores the sensed Photo Image in DRAM. Processingoccurs in 2 steps:

-   -   A small VLIW program reads the pixels from the FIFO and writes        them to DRAM via a Sequential Write Iterator.    -   The Photo Image in DRAM is rotated 90, 180 or 270 degrees        according to the orientation of the camera when the photo was        taken.

If the rotation is 0 degrees, then step 1 merely writes the Photo Imageout to the final Photo Image location and step 2 is not performed. Ifthe rotation is other than 0 degrees, the image is written out to atemporary area (for example into the Print Image memory area), and thenrotated during step 2 into the final Photo Image location. Step 1 isvery simple microcode, taking data from the VLIW Input FIFO 78 andwriting it to a Sequential Write Iterator. Step 2's rotation isaccomplished by using the accelerated Vark Affine Transform function.The processing is performed in 2 steps in order to reduce designcomplexity and to re-use the Vark affine transform rotate logic alreadyrequired for images. This is acceptable since both steps are completedin approximately 0.03 seconds, a time imperceptible to the operator ofthe Artcam. Even so, the read process is sensor speed bound, taking 0.02seconds to read the full frame, and approximately 0.01 seconds to rotatethe image.

The orientation is important for converting between the sensed PhotoImage and the internal format image, since the relative positioning ofR, G, and B pixels changes with orientation. The processed image mayalso have to be rotated during the Print process in order to be in thecorrect orientation for printing. The 3D model of the Artcam has 2 imagesensors, with their inputs multiplexed to a single ISI 83 (differentmicrocode, but same ACP 31). Since each sensor is a frame store, bothimages can be taken simultaneously, and then transferred to memory oneat a time.

Display Controller 88

When the “Take” button on an Artcam is half depressed, the TFT willdisplay the current image from the image sensor (converted via a simpleVLIW process). Once the Take button is fully depressed, the Taken Imageis displayed. When the user presses the Print button and imageprocessing begins, the TFT is turned off. Once the image has beenprinted the TFT is turned on again. The Display Controller 88 is used inthose Artcam models that incorporate a flat panel display. An exampledisplay is a TFT LCD of resolution 240×160 pixels. The structure of theDisplay Controller 88 is illustrated in FIG. 29. The Display Controller88 State Machine contains registers that control the timing of the SyncGeneration, where the display image is to be taken from (in DRAM via theData cache 76 via a specific Cache Group), and whether the TFT should beactive or not (via TFT Enable) at the moment. The CPU can write to theseregisters via the low speed bus. Displaying a 240×160 pixel image on anRGB TFT requires 3 components per pixel. The image taken from DRAM isdisplayed via 3 DACs, one for each of the R, G, and B output signals. Atan image refresh rate of 30 frames per second (60 fields per second) theDisplay Controller 88 requires data transfer rates of:

240×160×3×30=3.5 MB per second

This data rate is low compared to the rest of the system. However it ishigh enough to cause VLIW programs to slow down during the intensiveimage processing. The general principles of TFT operation should reflectthis.

Image Data Formats

As stated previously, the DRAM Interface 81 is responsible forinterfacing between other client portions of the ACP chip and the RAMBUSDRAM. In effect, each module within the DRAM Interface is an addressgenerator.

There are three logical types of images manipulated by the ACP. Theyare:

-   -   CCD Image, which is the Input Image captured from the CCD.    -   Internal Image format—the Image format utilised internally by        the Artcam device.

Print Image—the Output Image format printed by the Artcam

These images are typically different in color space, resolution, and theoutput & input color spaces which can vary from camera to camera. Forexample, a CCD image on a low-end camera may be a different resolution,or have different color characteristics from that used in a high-endcamera. However all internal image formats are the same format in termsof color space across all cameras.

In addition, the three image types can vary with respect to whichdirection is ‘up’. The physical orientation of the camera causes thenotion of a portrait or landscape image, and this must be maintainedthroughout processing. For this reason, the internal image is alwaysoriented correctly, and rotation is performed on images obtained fromthe CCD and during the print operation.

CCD Image Organization

Although many different CCD image sensors could be utilised, it will beassumed that the CCD itself is a 750×500 image sensor, yielding 375,000bytes (8 bits per pixel). Each 2×2 pixel block having the configurationas depicted in FIG. 30.

A CCD Image as stored in DRAM has consecutive pixels with a given linecontiguous in memory. Each line is stored one after the other. The imagesensor Interface 83 is responsible for taking data from the CCD andstoring it in the DRAM correctly oriented. Thus a CCD image withrotation 0 degrees has its first line G, R, G, R, G, R . . . and itssecond line as B, G, B, G, B, G . . . . If the CCD image should beportrait, rotated 90 degrees, the first line will be R, G, R, G, R, Gand the second line G, B, G, B, G, B . . . etc.

Pixels are stored in an interleaved fashion since all color componentsare required in order to convert to the internal image format.

It should be noted that the ACP 31 makes no assumptions about the CCDpixel format, since the actual CCDs for imaging may vary from Artcam toArtcam, and over time. All processing that takes place via the hardwareis controlled by major microcode in an attempt to extend the usefulnessof the ACP 31.

Internal Image Organization

Internal images typically consist of a number of channels. Vark imagescan include, but are not limited to:

Lab

Labα

LabΔ

αΔ

L

L, a and b correspond to components of the Lab color space, α is a mattechannel (used for compositing), and Δ is a bump-map channel (used duringbrushing, tiling and illuminating).

The VLIW processor 74 requires images to be organized in a planarconfiguration. Thus a Lab image would be stored as 3 separate blocks ofmemory:

one block for the L channel,

one block for the a channel, and

one block for the b channel

Within each channel block, pixels are stored contiguously for a givenrow (plus some optional padding bytes), and rows are stored one afterthe other.

Turning to FIG. 31 there is illustrated an example form of storage of alogical image 100. The logical image 100 is stored in a planar fashionhaving L 101, a 102 and b 103 color components stored one after another.Alternatively, the logical image 100 can be stored in a compressedformat having an uncompressed L component 101 and compressed A and Bcomponents 105, 106.

Turning to FIG. 32, the pixels of for line n 110 are stored togetherbefore the pixels of for line and n+1 (111). With the image being storedin contiguous memory within a single channel.

In the 8 MB-memory model, the final Print Image after all processing isfinished, needs to be compressed in the chrominance channels.Compression of chrominance channels can be 4:1, causing an overallcompression of 12:6, or 2:1.

Other than the final Print Image, images in the Artcam are typically notcompressed. Because of memory constraints, software may choose tocompress the final Print Image in the chrominance channels by scalingeach of these channels by 2:1. If this has been done, the PRINT Varkfunction call utilised to print an image must be told to treat thespecified chrominance channels as compressed. The PRINT function is theonly function that knows how to deal with compressed chrominance, andeven so, it only deals with a fixed 2:1 compression ratio.

Although it is possible to compress an image and then operate on thecompressed image to create the final print image, it is not recommendeddue to a loss in resolution. In addition, an image should only becompressed once—as the final stage before printout. While onecompression is virtually undetectable, multiple compressions may causesubstantial image degradation.

Clip Image Organization

Clip images stored on Artcards have no explicit support by the ACP 31.Software is responsible for taking any images from the current Artcardand organizing the data into a form known by the ACP. If images arestored compressed on an Artcard, software is responsible fordecompressing them, as there is no specific hardware support fordecompression of Artcard images.

Image Pyramid Organization

During brushing, tiling, and warping processes utilised to manipulate animage it is often necessary to compute the average color of a particulararea in an image. Rather than calculate the value for each area given,these functions make use of an image pyramid. As illustrated in FIG. 33,an image pyramid is effectively a multi-resolutionpixel-map. Theoriginal image 115 is a 1:1 representation. Low-pass filtering andsub-sampling by 2:1 in each dimension produces an image ¼ the originalsize 116. This process continues until the entire image is representedby a single pixel. An image pyramid is constructed from an originalinternal format image, and consumes ⅓ of the size taken up by theoriginal image (¼+ 1/16+ 1/64+ . . . ). For an original image of1500×1000 the corresponding image pyramid is approximately ½ MB. Animage pyramid is constructed by a specific Vark function, and is used asa parameter to other Vark functions.

Print Image Organization

The entire processed image is required at the same time in order toprint it. However the Print Image output can comprise a CMY ditheredimage and is only a transient image format, used within the Print Imagefunctionality. However, it should be noted that color conversion willneed to take place from the internal color space to the print colorspace. In addition, color conversion can be tuned to be different fordifferent print rolls in the camera with different ink characteristicse.g. Sepia output can be accomplished by using a specific sepia toningArtcard, or by using a sepia tone print-roll (so all Artcards will workin sepia tone).

Color Spaces

As noted previously there are 3 color spaces used in the Artcam,corresponding to the different image types.

The ACP has no direct knowledge of specific color spaces. Instead, itrelies on client color space conversion tables to convert between CCD,internal, and printer color spaces:

CCD:RGB

Internal:Lab

Printer:CMY

Removing the color space conversion from the ACP 31 allows:

-   -   Different CCDs to be used in different cameras    -   Different inks (in different print rolls over time) to be used        in the same camera    -   Separation of CCD selection from ACP design path    -   A well defined internal color space for accurate color        processing

Artcard Interface 87

The Artcard Interface (AI) takes data from the linear image Sensor whilean Artcard is passing under it, and makes that data available forstorage in DRAM. The image sensor produces 11,000 8-bit samples perscanline, sampling the Artcard at 4800 dpi. The AI is a state machinethat sends control information to the linear sensor, including LineSyncpulses and PixelClock pulses in order to read the image. Pixels are readfrom the linear sensor and placed into the VLIW Input FIFO 78. The VLIWis then able to process and/or store the pixels. The AI has only a fewregisters:

Register Name Description NumPixels The number of pixels in a sensorline (approx 11,000) Status The Print Head Interface's Status RegisterPixelsRemaining The number of bytes remaining in the current lineActions Reset A write to this register resets the AI, stops anyscanning, and loads all registers with 0. Scan A write to this registerwith a non-zero value sets the Scanning bit of the Status register, andcauses the Artcard Interface Scan cycle to start. A write to thisregister with 0 stops the scanning process and clears the Scanning bitin the Status register. The Scan cycle causes the AI to transferNumPixels bytes from the sensor to the VLIW Input FIFO 78, producing thePixelClock signals appropriately. Upon completion of NumPixels bytes, aLineSync pulse is given and the Scan cycle restarts. The PixelsRemainingregister holds the number of pixels remaining to be read on the currentscanline.

Note that the CPU should clear the VLIW Input FIFO 78 before initiatinga Scan. The Status register has bit interpretations as follows:

Bit Name Bits Description Scanning 1 If set, the AI is currentlyscanning, with the number of pixels remaining to be transferred from thecurrent line recorded in PixelsRemaining. If clear, the AI is notcurrently scanning, so is not transferring pixels to the VLIW Input FIFO78.

Artcard Interface (AI) 87

The Artcard Interface (AI) 87 is responsible for taking an Artcard imagefrom the Artcard Reader 34, and decoding it into the original data(usually a Vark script). Specifically, the AI 87 accepts signals fromthe Artcard scanner linear CCD 34, detects the bit pattern printed onthe card, and converts the bit pattern into the original data,correcting read errors.

With no Artcard 9 inserted, the image printed from an Artcam is simplythe sensed Photo Image cleaned up by any standard image processingroutines. The Artcard 9 is the means by which users are able to modify aphoto before printing it out. By the simple task of inserting a specificArtcard 9 into an Artcam, a user is able to define complex imageprocessing to be performed on the Photo Image. With no Artcard insertedthe Photo Image is processed in a standard way to create the PrintImage. When a single Artcard 9 is inserted into the Artcam, thatArtcard's effect is applied to the Photo Image to generate the PrintImage.

When the Artcard 9 is removed (ejected), the printed image reverts tothe Photo Image processed in a standard way. When the user presses thebutton to eject an Artcard, an event is placed in the event queuemaintained by the operating system running on the Artcam CentralProcessor 31. When the event is processed (for example after the currentPrint has occurred), the following things occur:

If the current Artcard is valid, then the Print Image is marked asinvalid and a ‘Process Standard’ event is placed in the event queue.When the event is eventually processed it will perform the standardimage processing operations on the Photo Image to produce the PrintImage.

The motor is started to eject the Artcard and a time-specific‘Stop-Motor’ Event is added to the event queue.

Inserting an Artcard

When a user inserts an Artcard 9, the Artcard Sensor 49 detects itnotifying the ACP72. This results in the software inserting an ‘ArtcardInserted’ event into the event queue. When the event is processedseveral things occur:

The current Artcard is marked as invalid (as opposed to ‘none’).

The Print Image is marked as invalid.

The Artcard motor 37 is started up to load the Artcard

The Artcard Interface 87 is instructed to read the Artcard

The Artcard Interface 87 accepts signals from the Artcard scanner linearCCD 34, detects the bit pattern printed on the card, and corrects errorsin the detected bit pattern, producing a valid Artcard data block inDRAM.

Reading Data from the Artcard CCD—General Considerations

As illustrated in FIG. 34, the Data Card reading process has 4 phasesoperated while the pixel data is read from the card. The phases are asfollows:

Phase 1. Detect data area on Artcard

Phase 2. Detect bit pattern from Artcard based on CCD pixels, and writeas bytes.

Phase 3. Descramble and XOR the byte-pattern

Phase 4. Decode data (Reed-Solomon decode)

As illustrated in FIG. 35, the Artcard 9 must be sampled at least atdouble the printed resolution to satisfy Nyquist's Theorem. In practiceit is better to sample at a higher rate than this. Preferably, thepixels are sampled 230 at 3 times the resolution of a printed dot ineach dimension, requiring 9 pixels to define a single dot. Thus if theresolution of the Artcard 9 is 1600 dpi, and the resolution of thesensor 34 is 4800 dpi, then using a 50 mm CCD image sensor results in9450 pixels per column. Therefore if we require 2 MB of dot data (at 9pixels per dot) then this requires 2 MB*8*9/9450=15,978columns=approximately 16,000 columns. Of course if a dot is not exactlyaligned with the sampling CCD the worst and most likely case is that adot will be sensed over a 16 pixel area (4×4) 231.

An Artcard 9 may be slightly warped due to heat damage, slightly rotated(up to, say 1 degree) due to differences in insertion into an Artcardreader, and can have slight differences in true data rate due tofluctuations in the speed of the reader motor 37. These changes willcause columns of data from the card not to be read as correspondingcolumns of pixel data. As illustrated in FIG. 36, a 1 degree rotation inthe Artcard 9 can cause the pixels from a column on the card to be readas pixels across 166 columns:

Finally, the Artcard 9 should be read in a reasonable amount of timewith respect to the human operator. The data on the Artcard covers mostof the Artcard surface, so timing concerns can be limited to the Artcarddata itself. A reading time of 1.5 seconds is adequate for Artcardreading.

The Artcard should be loaded in 1.5 seconds. Therefore all 16,000columns of pixel data must be read from the CCD 34 in 1.5 second, i.e.10,667 columns per second. Therefore the time available to read onecolumn is 1/10667 seconds, or 93,747 ns. Pixel data can be written tothe DRAM one column at a time, completely independently from anyprocesses that are reading the pixel data.

The time to write one column of data (9450/2 bytes since the reading canbe 4 bits per pixel giving 2×4 bit pixels per byte) to DRAM is reducedby using 8 cache lines. If 4 lines were written out at one time, the 4banks can be written to independently, and thus overlap latency reduced.Thus the 4725 bytes can be written in 11,840 ns (4725/128*320 ns). Thusthe time taken to write a given column's data to DRAM uses just under13% of the available bandwidth.

Decoding an Artcard

A simple look at the data sizes shows the impossibility of fitting theprocess into the 8 MB of memory 33 if the entire Artcard pixel data (140MB if each bit is read as a 3×3 array) as read by the linear CCD 34 iskept. For this reason, the reading of the linear CCD, decoding of thebitmap, and the un-bitmap process should take place in real-time (whilethe Artcard 9 is traveling past the linear CCD 34), and these processesmust effectively work without having entire data stores available.

When an Artcard 9 is inserted, the old stored Print Image and anyexpanded Photo Image becomes invalid. The new Artcard 9 can containdirections for creating a new image based on the currently capturedPhoto Image. The old Print Image is invalid, and the area holdingexpanded Photo Image data and image pyramid is invalid, leaving morethan 5 MB that can be used as scratch memory during the read process.Strictly speaking, the 1 MB area where the Artcard raw data is to bewritten can also be used as scratch data during the Artcard read processas long as by the time the final Reed-Solomon decode is to occur, that 1MB area is free again. The reading process described here does not makeuse of the extra 1 MB area (except as a final destination for the data).

It should also be noted that the unscrambling process requires two setsof 2 MB areas of memory since unscrambling cannot occur in place.Fortunately the 5 MB scratch area contains enough space for thisprocess.

Turning now to FIG. 37, there is shown a flowchart 220 of the stepsnecessary to decode the Artcard data. These steps include reading in theArtcard 221, decoding the read data to produce corresponding encodedXORed scrambled bitmap data 223. Next a checkerboard XOR is applied tothe data to produces encoded scrambled data 224. This data is thenunscrambled 227 to produce data 225 before this data is subjected toReed-Solomon decoding to produce the original raw data 226.Alternatively, unscrambling and XOR process can take place together, notrequiring a separate pass of the data. Each of the above steps isdiscussed in further detail hereinafter. As noted previously withreference to FIG. 37, the Artcard Interface, therefore, has 4 phases,the first 2 of which are time-critical, and must take place while pixeldata is being read from the CCD:

Phase 1. Detect data area on Artcard

Phase 2. Detect bit pattern from Artcard based on CCD pixels, and writeas bytes.

Phase 3. Descramble and XOR the byte-pattern

Phase 4. Decode data (Reed-Solomon decode)

The four phases are described in more detail as follows:

Phase 1. As the Artcard 9 moves past the CCD 34 the AI must detect thestart of the data area by robustly detecting special targets on theArtcard to the left of the data area. If these cannot be detected, thecard is marked as invalid. The detection must occur in real-time, whilethe Artcard 9 is moving past the CCD 34.

If necessary, rotation invariance can be provided. In this case, thetargets are repeated on the right side of the Artcard, but relative tothe bottom right corner instead of the top corner. In this way thetargets end up in the correct orientation if the card is inserted the“wrong” way. Phase 3 below can be altered to detect the orientation ofthe data, and account for the potential rotation.

Phase 2. Once the data area has been determined, the main read processbegins, placing pixel data from the CCD into an ‘Artcard data window’,detecting bits from this window, assembling the detected bits intobytes, and constructing a byte-image in DRAM. This must all be donewhile the Artcard is moving past the CCD.

Phase 3. Once all the pixels have been read from the Artcard data area,the Artcard motor 37 can be stopped, and the byte image descrambled andXORed. Although not requiring real-time performance, the process shouldbe fast enough not to annoy the human operator. The process must take 2MB of scrambled bit-image and write the unscrambled/XORed bit-image to aseparate 2 MB image.

Phase 4. The final phase in the Artcard read process is the Reed-Solomondecoding process, where the 2 MB bit-image is decoded into a 1 MB validArtcard data area. Again, while not requiring real-time performance itis still necessary to decode quickly with regard to the human operator.If the decode process is valid, the card is marked as valid. If thedecode failed, any duplicates of data in the bit-image are attempted tobe decoded, a process that is repeated until success or until there areno more duplicate images of the data in the bit image.

The four phase process described requires 4.5 MB of DRAM. 2 MB isreserved for Phase 2 output, and 0.5 MB is reserved for scratch dataduring phases 1 and 2. The remaining 2 MB of space can hold over 440columns at 4725 byes per column. In practice, the pixel data being readis a few columns ahead of the phase 1 algorithm, and in the worst case,about 180 columns behind phase 2, comfortably inside the 440 columnlimit.

A description of the actual operation of each phase will now be providedin greater detail.

Phase 1—Detect Data Area on Artcard

This phase is concerned with robustly detecting the left-hand side ofthe data area on the Artcard 9. Accurate detection of the data area isachieved by accurate detection of special targets printed on the leftside of the card. These targets are especially designed to be easy todetect even if rotated up to 1 degree.

Turning to FIG. 38, there is shown an enlargement of the left hand sideof an Artcard 9. The side of the card is divided into 16 bands, 239 witha target eg. 241 located at the center of each band. The bands arelogical in that there is no line drawn to separate bands. Turning toFIG. 39, there is shown a single target 241. The target 241, is aprinted black square containing a single white dot. The idea is todetect firstly as many targets 241 as possible, and then to join atleast 8 of the detected white-dot locations into a single logicalstraight line. If this can be done, the start of the data area 243 is afixed distance from this logical line. If it cannot be done, then thecard is rejected as invalid.

As shown in FIG. 38, the height of the card 9 is 3150 dots. A target(Target0) 241 is placed a fixed distance of 24 dots away from the topleft corner 244 of the data area so that it falls well within the firstof 16 equal sized regions 239 of 192 dots (576 pixels) with no target inthe final pixel region of the card. The target 241 must be big enough tobe easy to detect, yet be small enough not to go outside the height ofthe region if the card is rotated 1 degree. A suitable size for thetarget is a 31×31 dot (93×93 sensed pixels) black square 241 with thewhite dot 242.

At the worst rotation of 1 degree, a 1 column shift occurs every 57pixels. Therefore in a 590 pixel sized band, we cannot place any part ofour symbol in the top or bottom 12 pixels or so of the band or theycould be detected in the wrong band at CCD read time if the card isworst case rotated.

Therefore, if the black part of the rectangle is 57 pixels high (19dots) we can be sure that at least 9.5 black pixels will be read in thesame column by the CCD (worst case is half the pixels are in one columnand half in the next). To be sure of reading at least 10 black dots inthe same column, we must have a height of 20 dots. To give room forerroneous detection on the edge of the start of the black dots, weincrease the number of dots to 31, giving us 15 on either side of thewhite dot at the target's local coordinate (15, 15). 31 dots is 91pixels, which at most suffers a 3 pixel shift in column, easily withinthe 576 pixel band.

Thus each target is a block of 31×31 dots (93×93 pixels) each with thecomposition:

15 columns of 31 black dots each (45 pixel width columns of 93 pixels).

1 column of 15 black dots (45 pixels) followed by 1 white dot (3 pixels)and then a further 15 black dots (45 pixels)

15 columns of 31 black dots each (45 pixel width columns of 93 pixels)

Detect Targets

Targets are detected by reading columns of pixels, one column at a timerather than by detecting dots. It is necessary to look within a givenband for a number of columns consisting of large numbers of contiguousblack pixels to build up the left side of a target. Next, it is expectedto see a white region in the center of further black columns, andfinally the black columns to the left of the target center.

Eight cache lines are required for good cache performance on the readingof the pixels. Each logical read fills 4 cache lines via 4 sub-readswhile the other 4 cache-lines are being used. This effectively uses up13% of the available DRAM bandwidth.

As illustrated in FIG. 40, the detection mechanism FIFO for detectingthe targets uses a filter 245, run-length encoder 246, and a FIFO 247that requires special wiring of the top 3 elements (S1, S2, and S3) forrandom access.

The columns of input pixels are processed one at a time until either allthe targets are found, or until a specified number of columns have beenprocessed. To process a column, the pixels are read from DRAM, passedthrough a filter 245 to detect a 0 or 1, and then run length encoded246. The bit value and the number of contiguous bits of the same valueare placed in FIFO 247. Each entry of the FIFO 249 is in 8 bits, 7 bits250 to hold the run-length, and 1 bit 249 to hold the value of the bitdetected.

The run-length encoder 246 only encodes contiguous pixels within a 576pixel (192 dot) region.

The top 3 elements in the FIFO 247 can be accessed 252 in any randomorder. The run lengths (in pixels) of these entries are filtered into 3values: short, medium, and long in accordance with the following table:

Short Used to detect white dot. RunLength < 16 Medium Used to detectruns of black above or 16 <= RunLength < 48 below the white dot in thecenter of the target. Long Used to detect run lengths of black toRunLength >= 48 the left and right of the center dot in the target.

Looking at the top three entries in the FIFO 247 there are 3 specificcases of interest:

Case 1 S1 = white long We have detected a black column of the S2 = blacklong target to the left of or to the right of the S3 = white whitecenter dot. medium/long Case 2 S1 = white long If we've been processinga series of S2 = black medium columns of Case 1s, then we have S3 =white short probably detected the white dot in this Previous 8 columnscolumn. We know that the next entry will were Case 1 be black (or itwould have been included in the white S3 entry), but the number of blackpixels is in question. Need to verify by checking after the next FIFOadvance (see Case 3). Case 3 Prev = Case 2 We have detected part of thewhite dot. S3 = black med We expect around 3 of these, and then somemore columns of Case 1.

Preferably, the following information per region band is kept:

TargetDetected 1 bit BlackDetectCount 4 bits WhiteDetectCount 3 bitsPrevColumnStartPixel 15 bits TargetColumn ordinate 16 bits (15:1)TargetRow ordinate 16 bits (15:1) TOTAL 7 bytes (rounded to 8 bytes foreasy addressing)

Given a total of 7 bytes. It makes address generation easier if thetotal is assumed to be 8 bytes. Thus 16 entries requires 16*8=128 bytes,which fits in 4 cache lines. The address range should be inside thescratch 0.5 MB DRAM area since other phases make use of the remaining 4MB data area.

When beginning to process a given pixel column, the register valueS2StartPixel 254 is reset to 0. As entries in the FIFO advance from S2to S1, they are also added 255 to the existing S2StartPixel value,giving the exact pixel position of the run currently defined in S2.Looking at each of the 3 cases of interest in the FIFO, S2StartPixel canbe used to determine the start of the black area of a target (Cases 1and 2), and also the start of the white dot in the center of the target(Case 3). An algorithm for processing columns can be as follows:

1 TargetDetected[0-15] := 0 BlackDetectCount[0-15] := 0WhiteDetectCount[0-15] := 0 TargetRow[0-15] := 0 TargetColumn[0-15] := 0PrevColStartPixel[0-15] := 0 CurrentColumn := 0 2 Do ProcessColumn 3CurrentColumn++ 4 If (CurrentColumn <= LastValidColumn) Goto 2

The steps involved in the processing a column (Process Column) are asfollows:

1 S2StartPixel := 0 FIFO := 0 BlackDetectCount := 0 WhiteDetectCount :=0 ThisColumnDetected := FALSE PrevCaseWasCase2 := FALSE 2 If (!TargetDetected[Target]) & (! ColumnDetected[Target])  ProcessCases EndIf3 PrevCaseWasCase2 := Case=2 4 Advance FIFO

The processing for each of the 3 (Process Cases) cases is as follows:

Case 1:

BlackDetectCount[target] < 8 Δ := ABS(S2StartPixel − ORPrevColStartPixel[Target]) WhiteDetectCount[Target] = 0 If (0<=Δ< 2) BlackDetectCount[Target]++  (max value =8) Else BlackDetectCount[Target] := 1  WhiteDetectCount[Target] := 0 EndIfPrevColStartPixel[Target] := S2StartPixel ColumnDetected[Target] := TRUEBitDetected = 1 BlackDetectCount[target] >= 8 PrevColStartPixel[Target]:= WhiteDetectCount[Target] != 0 S2StartPixel ColumnDetected[Target] :=TRUE BitDetected = 1 TargetDetected[Target] := TRUE TargetColumn[Target]:= CurrentColumn − 8 − (WhiteDetectCount[Target]/2)

Case 2:

No special processing is recorded except for setting the‘PrevCaseWasCase2’ flag for identifying Case 3 (see Step 3 of processinga column described above)

Case 3:

PrevCaseWasCase2 = TRUE If (WhiteDetectCount[Target] < 2)BlackDetectCount[Target] >= 8  TargetRow[Target] = S2StartPixel +WhiteDetectCount=1 (S2_(RunLength)/2) EndIf Δ := ABS(S2StartPixel −PrevColStartPixel[Target]) If (0<=Δ< 2)  WhiteDetectCount[Target]++ Else WhiteDetectCount[Target] := 1 EndIf PrevColStartPixel[Target] :=S2StartPixel ThisColumnDetected := TRUE BitDetected = 0

At the end of processing a given column, a comparison is made of thecurrent column to the maximum number of columns for target detection. Ifthe number of columns allowed has been exceeded, then it is necessary tocheck how many targets have been found. If fewer than 8 have been found,the card is considered invalid.

Process Targets

After the targets have been detected, they should be processed. All thetargets may be available or merely some of them. Some targets may alsohave been erroneously detected.

This phase of processing is to determine a mathematical line that passesthrough the center of as many targets as possible. The more targets thatthe line passes through, the more confident the target position has beenfound. The limit is set to be 8 targets. If a line passes through atleast 8 targets, then it is taken to be the right one.

It is all right to take a brute-force but straightforward approach sincethere is the time to do so (see below), and lowering complexity makestesting easier. It is necessary to determine the line between targets 0and 1 (if both targets are considered valid) and then determine how manytargets fall on this line. Then we determine the line between targets 0and 2, and repeat the process. Eventually we do the same for the linebetween targets 1 and 2, 1 and 3 etc. and finally for the line betweentargets 14 and 15. Assuming all the targets have been found, we need toperform 15+14+13+ . . . =90 sets of calculations (with each set ofcalculations requiring 16 tests=1440 actual calculations), and choosethe line which has the maximum number of targets found along the line.The algorithm for target location can be as follows:

TargetA := 0 MaxFound := 0 BestLine := 0 While (TargetA < 15) If(TargetA is Valid) TargetB:= TargetA + 1 While (TargetB<= 15) If(TargetB is valid) CurrentLine := line between TargetA and TargetBTargetC := 0; While (TargetC <= 15) If (TargetC valid AND TargetC online AB) TargetsHit++ EndIf If (TargetsHit > MaxFound) MaxFound :=TargetsHit BestLine := CurrentLine EndIf TargetC++ EndWhile EndIfTargetB ++ EndWhile EndIf TargetA++ EndWhile If (MaxFound < 8) Card isInvalid Else Store expected centroids for rows based on BestLine EndIf

As illustrated in FIG. 34, in the algorithm above, to determine aCurrentLine 260 from Target A 261 and target B, it is necessary tocalculate Δrow (264) & Δcolumn (263) between targets 261, 262, and thelocation of Target A. It is then possible to move from Target 0 toTarget 1 etc. by adding Δrow and Δcolumn. The found (if actually found)location of target N can be compared to the calculated expected positionof Target N on the line, and if it falls within the tolerance, thenTarget N is determined to be on the line.

To calculate Δrow & Δcolumn:

Δrow=(row_(TargetA)−row_(TargetB))/(B−A)

Δcolumn=(column_(TargetA)−column_(TargetB))/(B−A)

Then we calculate the position of Target0:

row=rowTargetA−(A*Δrow)

column=columnTargetA−(A*Δcolumn)

And compare (row, column) against the actual row_(Target0) andcolumn_(Target0). To move from one expected target to the next (e.g.from Target0 to Target1), we simply add Δrow and Δcolumn to row andcolumn respectively. To check if each target is on the line, we mustcalculate the expected position of Target0 and then perform one add andone comparison for each target ordinate.

At the end of comparing all 16 targets against a maximum of 90 lines,the result is the best line through the valid targets. If that linepasses through at least 8 targets (i.e. MaxFound>=8), it can be saidthat enough targets have been found to form a line, and thus the cardcan be processed. If the best line passes through fewer than 8, then thecard is considered invalid.

The resulting algorithm takes 180 divides to calculate Δrow and Δcolumn,180 multiply/adds to calculate target0 position, and then 2880adds/comparisons. The time we have to perform this processing is thetime taken to read 36 columns of pixel data=3,374,892 ns. Not evenaccounting for the fact that an add takes less time than a divide, it isnecessary to perform 3240 mathematical operations in 3,374,892 ns. Thatgives approximately 1040 ns per operation, or 104 cycles. The CPU cantherefore safely perform the entire processing of targets, reducingcomplexity of design.

Update Centroids Based on Data Edge Border and Clockmarks

Step 0: Locate the Data Area

From Target 0 (241 of FIG. 38) it is a predetermined fixed distance inrows and columns to the top left border 244 of the data area, and then afurther 1 dot column to the vertical clock marks 276. So we use TargetA,Δrow and Δcolumn found in the previous stage (Δrow and Δcolumn refer todistances between targets) to calculate the centroid or expectedlocation for Target0 as described previously.

Since the fixed pixel offset from Target0 to the data area is related tothe distance between targets (192 dots between targets, and 24 dotsbetween Target0 and the data area 243), simply add Δrow/8 to Target0'scentroid column coordinate (aspect ratio of dots is 1:1). Thus the topco-ordinate can be defined as:

(column_(DotColumnTop)=column_(Target0)+(Δrow/8)

(row_(DotColumnTop)=row_(Target)0+(Δcolumn/8)

Next Δrow and Δcolumn are updated to give the number of pixels betweendots in a single column (instead of between targets) by dividing them bythe number of dots between targets:

Δrow=Δrow/192

Δcolumn=Δcolumn/192

We also set the currentColumn register (see Phase 2) to be −1 so thatafter step 2, when phase 2 begins, the currentColumn register willincrement from −1 to 0.

Step 1: Write Out the Initial Centroid Deltas (Δ) and Bit History

This simply involves writing setup information required for Phase 2.

This can be achieved by writing 0s to all the Δrow and Δcolumn entriesfor each row, and a bit history. The bit history is actually an expectedbit history since it is known that to the left of the clock mark column276 is a border column 277, and before that, a white area. The bithistory therefore is 011, 010, 011, 010 etc.

Step 2: Update the Centroids Based on Actual Pixels Read.

The bit history is set up in Step 1 according to the expected clockmarks and data border. The actual centroids for each dot row can now bemore accurately set (they were initially 0) by comparing the expecteddata against the actual pixel values. The centroid updating mechanism isachieved by simply performing step 3 of Phase 2.

Phase 2—Detect Bit Pattern from Artcard Based on Pixels Read, and Writeas Bytes.

Since a dot from the Artcard 9 requires a minimum of 9 sensed pixelsover 3 columns to be represented, there is little point in performingdot detection calculations every sensed pixel column. It is better toaverage the time required for processing over the average dotoccurrence, and thus make the most of the available processing time.This allows processing of a column of dots from an Artcard 9 in the timeit takes to read 3 columns of data from the Artcard. Although the mostlikely case is that it takes 4 columns to represent a dot, the 4^(th)column will be the last column of one dot and the first column of a nextdot. Processing should therefore be limited to only 3 columns.

As the pixels from the CCD are written to the DRAM in 13% of the timeavailable, 83% of the time is available for processing of 1 column ofdots i.e. 83% of (93,747*3)=83% of 281,241 ns=233,430 ns.

In the available time, it is necessary to detect 3150 dots, and writetheir bit values into the raw data area of memory. The processingtherefore requires the following steps:

For each column of dots on the Artcard:

Step 0: Advance to the next dot column

Step 1: Detect the top and bottom of an Artcard dot column (check clockmarks)

Step 2: Process the dot column, detecting bits and storing themappropriately

Step 3: Update the centroids

Since we are processing the Artcard's logical dot columns, and these mayshift over 165 pixels, the worst case is that we cannot process thefirst column until at least 165 columns have been read into DRAM. Phase2 would therefore finish the same amount of time after the read processhad terminated. The worst case time is: 165*93,747 ns=15,468,255 ns or0.015 seconds.

Step 0: Advance to the Next Dot Column

In order to advance to the next column of dots we add Δrow and Δcolumnto the dotColumnTop to give us the centroid of the dot at the top of thecolumn. The first time we do this, we are currently at the clock markscolumn 276 to the left of the bit image data area, and so we advance tothe first column of data. Since Δrow and Δcolumn refer to distancebetween dots within a column, to move between dot columns it isnecessary to add Δrow to column_(dotColumnTop) and Δcolumn torow_(dotColumnTop).

To keep track of what column number is being processed, the columnnumber is recorded in a register called CurrentColumn. Every time thesensor advances to the next dot column it is necessary to increment theCurrentColumn register. The first time it is incremented, it isincremented from −1 to 0 (see Step 0 Phase 1). The CurrentColumnregister determines when to terminate the read process (when reachingmaxColumns), and also is used to advance the DataOut Pointer to the nextcolumn of byte information once all 8 bits have been written to the byte(once every 8 dot columns). The lower 3 bits determine what bit we're upto within the current byte. It will be the same bit being written forthe whole column.

Step 1: Detect the Top and Bottom of an Artcard Dot Column.

In order to process a dot column from an Artcard, it is necessary todetect the top and bottom of a column. The column should form a straightline between the top and bottom of the column (except for local warpingetc.). Initially dotColumnTop points to the clock mark column 276. Wesimply toggle the expected value, write it out into the bit history, andmove on to step 2, whose first task will be to add the Δrow and Δcolumnvalues to dotColumnTop to arrive at the first data dot of the column.

Step 2: Process an Artcard's Dot Column

Given the centroids of the top and bottom of a column in pixelcoordinates the column should form a straight line between them, withpossible minor variances due to warping etc.

Assuming the processing is to start at the top of a column (at the topcentroid coordinate) and move down to the bottom of the column,subsequent expected dot centroids are given as:

row_(next)=row+Δrow

column_(next)=column+Δcolumn

This gives us the address of the expected centroid for the next dot ofthe column. However to account for local warping and error we addanother Δrow and Δcolumn based on the last time we found the dot in agiven row. In this way we can account for small drifts that accumulateinto a maximum drift of some percentage from the straight line joiningthe top of the column to the bottom.

We therefore keep 2 values for each row, but store them in separatetables since the row history is used in step 3 of this phase.

-   -   Δrow and Δcolumn (2 @ 4 bits each=1 byte)    -   row history (3 bits per row, 2 rows are stored per byte)

For each row we need to read a Δrow and Δcolumn to determine the changeto the centroid. The read process takes 5% of the bandwidth and 2 cachelines:

76*(3150/32)+2*3150=13,824 ns=5% of bandwidth

Once the centroid has been determined, the pixels around the centroidneed to be examined to detect the status of the dot and hence the valueof the bit. In the worst case a dot covers a 4×4 pixel area. However,thanks to the fact that we are sampling at 3 times the resolution of thedot, the number of pixels required to detect the status of the dot andhence the bit value is much less than this. We only require access to 3columns of pixel columns at any one time.

In the worst case of pixel drift due to a 1% rotation, centroids willshift 1 column every 57 pixel rows, but since a dot is 3 pixels indiameter, a given column will be valid for 171 pixel rows (3*57). As abyte contains 2 pixels, the number of bytes valid in each buffered read(4 cache lines) will be a worst case of 86 (out of 128 read).

Once the bit has been detected it must be written out to DRAM. We storethe bits from 8 columns as a set of contiguous bytes to minimize DRAMdelay. Since all the bits from a given dot column will correspond to thenext bit position in a data byte, we can read the old value for thebyte, shift and OR in the new bit, and write the byte back. Theread/shift&OR/write process requires 2 cache lines.

We need to read and write the bit history for the given row as we updateit. We only require 3 bits of history per row, allowing the storage of 2rows of history in a single byte. The read/shift&OR/write processrequires 2 cache lines.

The total bandwidth required for the bit detection and storage issummarised in the following table:

Read centroid Δ 5% Read 3 columns of pixel data 19% Read/Write detectedbits into byte buffer 10% Read/Write bit history 5% TOTAL 39%

Detecting a Dot

The process of detecting the value of a dot (and hence the value of abit) given a centroid is accomplished by examining 3 pixel values andgetting the result from a lookup table. The process is fairly simple andis illustrated in FIG. 42. A dot 290 has a radius of about 1.5 pixels.Therefore the pixel 291 that holds the centroid, regardless of theactual position of the centroid within that pixel, should be 100% of thedot's value. If the centroid is exactly in the center of the pixel 291,then the pixels above 292 & below 293 the centroid's pixel, as well asthe pixels to the left 294 & right 295 of the centroid's pixel willcontain a majority of the dot's value. The further a centroid is awayfrom the exact center of the pixel 295, the more likely that more thanthe center pixel will have 100% coverage by the dot.

Although FIG. 42 only shows centroids differing to the left and belowthe center, the same relationship obviously holds for centroids aboveand to the right of center. In Case 1, the centroid is exactly in thecenter of the middle pixel 295. The center pixel 295 is completelycovered by the dot, and the pixels above, below, left, and right arealso well covered by the dot. In Case 2, the centroid is to the left ofthe center of the middle pixel 291. The center pixel is still completelycovered by the dot, and the pixel 294 to the left of the center is nowcompletely covered by the dot. The pixels above 292 and below 293 arestill well covered. In Case 3, the centroid is below the center of themiddle pixel 291. The center pixel 291 is still completely covered bythe dot 291, and the pixel below center is now completely covered by thedot. The pixels left 294 and right 295 of center are still well covered.In Case 4, the centroid is left and below the center of the middlepixel. The center pixel 291 is still completely covered by the dot, andboth the pixel to the left of center 294 and the pixel below center 293are completely covered by the dot.

The algorithm for updating the centroid uses the distance of thecentroid from the center of the middle pixel 291 in order to select 3representative pixels and thus decide the value of the dot:

Pixel 1: the pixel containing the centroid

Pixel 2: the pixel to the left of Pixel 1 if the centroid's X coordinate(column value) is <½, otherwise the pixel to the right of Pixel 1.

Pixel 3: the pixel above pixel 1 if the centroid's Y coordinate (rowvalue) is <½, otherwise the pixel below Pixel 1.

As shown in FIG. 43, the value of each pixel is output to apre-calculated lookup table 301. The 3 pixels are fed into a 12-bitlookup table, which outputs a single bit indicating the value of thedot—on or off. The lookup table 301 is constructed at chip definitiontime, and can be compiled into about 500 gates. The lookup table can bea simple threshold table, with the exception that the center pixel(Pixel 1) is weighted more heavily.

Step 3: Update the Centroid Δs for Each Row in the Column

The idea of the Δs processing is to use the previous bit history togenerate a ‘perfect’ dot at the expected centroid location for each rowin a current column. The actual pixels (from the CCD) are compared withthe expected ‘perfect’ pixels. If the two match, then the actualcentroid location must be exactly in the expected position, so thecentroid Δs must be valid and not need updating. Otherwise a process ofchanging the centroid Δs needs to occur in order to best fit theexpected centroid location to the actual data. The new centroid Δs willbe used for processing the dot in the next column.

Updating the centroid Δs is done as a subsequent process from Step 2 forthe following reasons:

to reduce complexity in design, so that it can be performed as Step 2 ofPhase 1 there is enough bandwidth remaining to allow it to allow reuseof DRAM buffers, and

to ensure that all the data required for centroid updating is availableat the start of the process without special pipelining.

The centroid Δ are processed as Δcolumn Δrow respectively to reducecomplexity.

Although a given dot is 3 pixels in diameter, it is likely to occur in a4×4 pixel area. However the edge of one dot will as a result be in thesame pixel as the edge of the next dot. For this reason, centroidupdating requires more than simply the information about a given singledot.

FIG. 44 shows a single dot 310 from the previous column with a givencentroid 311. In this example, the dot 310 extend Δ over 4 pixel columns312-315 and in fact, part of the previous dot column's dot(coordinate=(Prevcolumn, Current Row)) has entered the current columnfor the dot on the current row. If the dot in the current row and columnwas white, we would expect the rightmost pixel column 314 from theprevious dot column to be a low value, since there is only the dotinformation from the previous column's dot (the current column's dot iswhite). From this we can see that the higher the pixel value is in thispixel column 315, the more the centroid should be to the right Ofcourse, if the dot to the right was also black, we cannot adjust thecentroid as we cannot get information sub-pixel. The same can be saidfor the dots to the left, above and below the dot at dot coordinates(PrevColumn, CurrentRow).

From this we can say that a maximum of 5 pixel columns and rows arerequired. It is possible to simplify the situation by taking the casesof row and column centroid Δs separately, treating them as the sameproblem, only rotated 90 degrees.

Taking the horizontal case first, it is necessary to change the columncentroid Δs if the expected pixels don't match the detected pixels. Fromthe bit history, the value of the bits found for the Current Row in thecurrent dot column, the previous dot column, and the (previous-1)th dotcolumn are known. The expected centroid location is also known. Usingthese two pieces of information, it is possible to generate a 20 bitexpected bit pattern should the read be ‘perfect’. The 20 bitbit-pattern represents the expected Δ values for each of the 5 pixelsacross the horizontal dimension. The first nibble would represent therightmost pixel of the leftmost dot. The next 3 nibbles represent the 3pixels across the center of the dot 310 from the previous column, andthe last nibble would be the leftmost pixel 317 of the rightmost dot(from the current column).

If the expected centroid is in the center of the pixel, we would expecta 20 bit pattern based on the following table:

Bit history Expected pixels 000 00000 001 0000D 010 0DFD0 011 0DFDD 100D0000 101 D000D 110 DDFD0 111 DDFDD

The pixels to the left and right of the center dot are either 0 or Ddepending on whether the bit was a 0 or 1 respectively. The center threepixels are either 000 or DFD depending on whether the bit was a 0 or 1respectively. These values are based on the physical area taken by a dotfor a given pixel. Depending on the distance of the centroid from theexact center of the pixel, we would expect data shifted slightly, whichreally only affects the pixels either side of the center pixel. Sincethere are 16 possibilities, it is possible to divide the distance fromthe center by 16 and use that amount to shift the expected pixels.

Once the 20 bit 5 pixel expected value has been determined it can becompared against the actual pixels read. This can proceed by subtractingthe expected pixels from the actual pixels read on a pixel by pixelbasis, and finally adding the differences together to obtain a distancefrom the expected Δ values.

FIG. 45 illustrates one form of implementation of the above algorithmwhich includes a look up table 320 which receives the bit history 322and central fractional component 323 and outputs 324 the corresponding20 bit number which is subtracted 321 from the central pixel input 326to produce a pixel difference 327.

This process is carried out for the expected centroid and once for ashift of the centroid left and right by 1 amount in Δcolumn. Thecentroid with the smallest difference from the actual pixels isconsidered to be the ‘winner’ and the Δcolumn updated accordingly (whichhopefully is ‘no change’). As a result, a Δcolumn cannot change by morethan 1 each dot column.

The process is repeated for the vertical pixels, and Δrow isconsequentially updated.

There is a large amount of scope here for parallelism. Depending on therate of the clock chosen for the ACP unit 31 these units can be placedin series (and thus the testing of 3 different Δ could occur inconsecutive clock cycles), or in parallel where all 3 can be testedsimultaneously. If the clock rate is fast enough, there is less need forparallelism.

Bandwidth Utilization

It is necessary to read the old Δ of the Δs, and to write them outagain. This takes 10% of the bandwidth:

2*(76(3150/32)+2*3150)=27,648 ns=10% of bandwidth

It is necessary to read the bit history for the given row as we updateits Δs. Each byte contains 2 row's bit histories, thus taking 2.5% ofthe bandwidth:

76((3150/2)/32)+2*(3150/2)=4,085 ns=2.5% of bandwidth

In the worst case of pixel drift due to a 1% rotation, centroids willshift 1 column every 57 pixel rows, but since a dot is 3 pixels indiameter, a given pixel column will be valid for 171 pixel rows (3*57).As a byte contains 2 pixels, the number of bytes valid in cached readswill be a worst case of 86 (out of 128 read). The worst case timing for5 columns is therefore 31% bandwidth.

5*(((9450/(128*2))*320)*128/86)=88, 112 ns=31% of bandwidth.

The total bandwidth required for the updating the centroid Δ issummarised in the following table:

Read/Write centroid Δ 10% Read bit history 2.5%  Read 5 columns of pixeldata 31% TOTAL 43.5%  

Memory Usage for Phase 2:

The 2 MB bit-image DRAM area is read from and written to during Phase 2processing. The 2 MB pixel-data DRAM area is read.

The 0.5 MB scratch DRAM area is used for storing row data, namely:

Centroid array 24 bits (16:8) * 2 * 3150 = 18,900 byes Bit History array3 bits * 3150 entries (2 per byte) = 1575 bytes

Phase 3—Unscramble and XOR the Raw Data

Returning to FIG. 37, the next step in decoding is to unscramble and XORthe raw data. The 2 MB byte image, as taken from the Artcard, is in ascrambled XORed form. It must be unscrambled and re-XORed to retrievethe bit image necessary for the Reed Solomon decoder in phase 4.

Turning to FIG. 46, the unscrambling process 330 takes a 2 MB scrambledbyte image 331 and writes an unscrambled 2 MB image 332. The processcannot reasonably be performed in-place, so 2 sets of 2 MB areas areutilised. The scrambled data 331 is in symbol block order arranged in a16×16 array, with symbol block 0 (334) having all the symbol 0's fromall the code words in random order. Symbol block 1 has all the symbol1's from all the code words in random order etc. Since there are only255 symbols, the 256^(th) symbol block is currently unused.

A linear feedback shift register is used to determine the relationshipbetween the position within a symbol block eg. 334 and what code wordeg. 355 it came from. This works as long as the same seed is used whengenerating the original Artcard images. The XOR of bytes fromalternative source lines with 0xAA and 0x55 respectively is effectivelyfree (in time) since the bottleneck of time is waiting for the DRAM tobe ready to read/write to non-sequential addresses.

The timing of the unscrambling XOR process is effectively 2 MB of randombyte-reads, and 2 MB of random byte-writes i.e. 2*(2 MB*76 ns+2 MB*2ns)=327,155,712 ns or approximately 0.33 seconds. This timing assumes nocaching.

Phase 4—Reed Solomon Decode

This phase is a loop, iterating through copies of the data in the bitimage, passing them to the Reed-Solomon decode module until either asuccessful decode is made or until there are no more copies to attemptdecode from.

The Reed-Solomon decoder used can be the VLIW processor, suitablyprogrammed or, alternatively, a separate hardwired core such as LSILogic's L64712. The L64712 has a throughput of 50 Mbits per second(around 6.25 MB per second), so the time may be bound by the speed ofthe Reed-Solomon decoder rather than the 2 MB read and 1 MB write memoryaccess time (500 MB/sec for sequential accesses). The time taken in theworst case is thus 2/6.25 s=approximately 0.32 seconds. Of course, otherartcard formats are possible.

Phase 5 Running the Vark Script

The overall time taken to read the Artcard 9 and decode it is thereforeapproximately 2.15 seconds. The apparent delay to the user is actuallyonly 0.65 seconds (the total of Phases 3 and 4), since the Artcard stopsmoving after 1.5 seconds.

Once the Artcard is loaded, the Artvark script must be interpreted,Rather than run the script immediately, the script is only run upon thepressing of the ‘Print’ button 13 (FIG. 1). The taken to run the scriptwill vary depending on the complexity of the script, and must be takeninto account for the perceived delay between pressing the print buttonand the actual print button and the actual printing.

As noted previously, the VLIW processor 74 is a digital processingsystem that accelerates computationally expensive Vark functions. Thebalance of functions performed in software by the CPU core 72, and inhardware by the VLIW processor 74 will be implementation dependent. Thegoal of the VLIW processor 74 is to assist all Artcard styles to executein a time that does not seem too slow to the user. As CPUs become fasterand more powerful, the number of functions requiring hardwareacceleration becomes less and less. The VLIW processor has a microcodedALU sub-system that allows general hardware speed up of the followingtime-critical functions.

1) Image access mechanisms for general software processing2) Image convolver.3) Data driven image warper4) Image scaling5) Image tessellation6) Affine transform7) Image compositor8) Color space transform9) Histogram collector

10) Illumination of the Image

11) Brush stamper12) Histogram collector13) CCD image to internal image conversion14) Construction of image pyramids (used by warper & for brushing)

The following table summarizes the time taken for each Vark operation ifimplemented in the ALU model. The method of implementing the functionusing the ALU model is described hereinafter.

1500 * 1000 image Operation Speed of Operation 1 channel 3 channelsImage composite 1 cycle per output 0.015 s 0.045 s pixel Image convolvek/3 cycles per output pixel (k = kernel size) 3 × 3 convolve 0.045 s0.135 s 5 × 5 convolve 0.125 s 0.375 s 7 × 7 convolve 0.245 s 0.735 sImage warp 8 cycles per pixel 0.120 s 0.360 s Histogram collect 2 cyclesper pixel 0.030 s 0.090 s Image Tessellate ⅓ cycle per pixel 0.005 s0.015 s Image sub-pixel 1 cycle per output — — Translate pixel Colorlookup ½ cycle per pixel 0.008 s 0.023 replace Color space 8 cycles perpixel 0.120 s 0.360 s transform Convert CCD 4 cycles per output  0.06 s 0.18 s image to internal pixel image (including color convert & scale)Construct image 1 cycle per input 0.015 s 0.045 s pyramid pixel ScaleMaximum of: 0.015 s 0.045 s 2 cycles per input (minimum) (minimum) pixel2 cycles per output pixel 2 cycles per output pixel (scaled in X only)Affine transform 2 cycles per output  0.03 s  0.09 s pixel Brush rotate/? translate and composite Tile Image 4-8 cycles per 0.015 s to 0.060 sto 0.120 s output pixel 0.030 s to for 4 channels (Lab, texture)Illuminate image Cycles per pixel Ambient only ½ 0.008 s 0.023 sDirectional light  1 0.015 s 0.045 s Directional (bm)  6  0.09 s  0.27 sOmni light  6  0.09 s  0.27 s Omni (bm)  9 0.137 s  0.41 s Spotlight  90.137 s  0.41 s Spotlight (bm) 12  0.18 s  0.54 s (bm) = bumpmap

For example, to convert a CCD image, collect histogram & performlookup-color replacement (for image enhancement) takes: 9+2+0.5 cyclesper pixel, or 11.5 cycles. For a 1500×1000 image that is 172,500,000, orapproximately 0.2 seconds per component, or 0.6 seconds for all 3components. Add a simple warp, and the total comes to 0.6+0.36, almost 1second.

Image Convolver

A convolve is a weighted average around a center pixel. The average maybe a simple sum, a sum of absolute values, the absolute value of a sum,or sums truncated at 0.

The image convolver is a general-purpose convolver, allowing a varietyof functions to be implemented by varying the values within avariable-sized coefficient kernel. The kernel sizes supported are 3×3,5×5 and 7×7 only.

Turning now to FIG. 82, there is illustrated 340 an example of theconvolution process. The pixel component values fed into the convolverprocess 341 come from a Box Read Iterator 342. The Iterator 342 providesthe image data row by row, and within each row, pixel by pixel. Theoutput from the convolver 341 is sent to a Sequential Write Iterator344, which stores the resultant image in a valid image format.

A Coefficient Kernel 346 is a lookup table in DRAM. The kernel isarranged with coefficients in the same order as the Box Read Iterator342. Each coefficient entry is 8 bits. A simple Sequential Read Iteratorcan be used to index into the kernel 346 and thus provide thecoefficients. It simulates an image with ImageWidth equal to the kernelsize, and a Loop option is set so that the kernel would continuously beprovided.

One form of implementation of the convolve process on an ALU unit is asillustrated in FIG. 81. The following constants are set by software:

Constant Value K₁ Kernel size (9, 25, or 49)

The control logic is used to count down the number of multiply/adds perpixel. When the count (accumulated in Latch₂) reaches 0, the controlsignal generated is used to write out the current convolve value (fromLatch₁) and to reset the count. In this way, one control logic block canbe used for a number of parallel convolve streams.

Each cycle the multiply ALU can perform one multiply/add to incorporatethe appropriate part of a pixel. The number of cycles taken to sum upall the values is therefore the number of entries in the kernel. Sincethis is compute bound, it is appropriate to divide the image intomultiple sections and process them in parallel on different ALU units.

On a 7×7 kernel, the time taken for each pixel is 49 cycles, or 490 ns.Since each cache line holds 32 pixels, the time available for memoryaccess is 12,740 ns. ((32−7+1)×490 ns). The time taken to read 7 cachelines and write 1 is worse case 1,120 ns (8*140 ns, all accesses to sameDRAM bank). Consequently it is possible to process up to 10 pixels inparallel given unlimited resources. Given a limited number of ALUs it ispossible to do at best 4 in parallel. The time taken to thereforeperform the convolution using a 7×7 kernel is 0.18375 seconds(1500*1000*490 ns/4=183,750,000 ns).

On a 5×5 kernel, the time taken for each pixel is 25 cycles, or 250 ns.Since each cache line holds 32 pixels, the time available for memoryaccess is 7,000 ns. ((32−5+1)×250 ns). The time taken to read 5 cachelines and write 1 is worse case 840 ns (6*140 ns, all accesses to sameDRAM bank). Consequently it is possible to process up to 7 pixels inparallel given unlimited resources. Given a limited number of ALUs it ispossible to do at best 4. The time taken to therefore perform theconvolution using a 5×5 kernel is 0.09375 seconds (1500*1000*250ns/4=93,750,000 ns).

On a 3×3 kernel, the time taken for each pixel is 9 cycles, or 90 ns.Since each cache line holds 32 pixels, the time available for memoryaccess is 2,700 ns. ((32−3+1)×90 ns). The time taken to read 3 cachelines and write 1 is worse case 560 ns (4*140 ns, all accesses to sameDRAM bank). Consequently it is possible to process up to 4 pixels inparallel given unlimited resources. Given a limited number of ALUs andRead/Write Iterators it is possible to do at best 4. The time taken totherefore perform the convolution using a 3×3 kernel is 0.03375 seconds(1500*1000*90 ns/4=33,750,000 ns).

Consequently each output pixel takes kernelsize/3 cycles to compute. Theactual timings are summarised in the following table:

Time taken to Time to process Time to Process calculate output 1 channelat 3 channels at Kernel size pixel 1500 × 1000 1500 × 1000 3 × 3 (9)  3cycles 0.045 seconds 0.135 seconds 5 × 5 (25) 8⅓ cycles 0.125 seconds0.375 seconds 7 × 7 (49) 16⅓ cycles 0.245 seconds 0.735 seconds

Image Compositor

Compositing is to add a foreground image to a background image using amatte or a channel to govern the appropriate proportions of backgroundand foreground in the final image. Two styles of compositing arepreferably supported, regular compositing and associated compositing.The rules for the two styles are:

Regular composite: new Value=Foreground+(Background−Foreground)a

Associated composite: new value=Foreground+(1−a)Background

The difference then, is that with associated compositing, the foregroundhas been pre-multiplied with the matte, while in regular compositing ithas not. An example of the compositing process is as illustrated in FIG.83.

The alpha channel has values from 0 to 255 corresponding to the range 0to 1.

Regular Composite

A regular composite is implemented as:

Foreground+(Background−Foreground)*α/255

The division by X/255 is approximated by 257X/65536. An implementationof the compositing process is shown in more detail in FIG. 84, where thefollowing constant is set by software:

Constant Value K₁ 257

Since 4 Iterators are required, the composite process takes 1 cycle perpixel, with a utilization of only half of the ALUs. The compositeprocess is only run on a single channel. To composite a 3-channel imagewith another, the compositor must be run 3 times, once for each channel.

The time taken to composite a full size single channel is 0.015 s(1500*1000*1*10 ns), or 0.045 s to composite all 3 channels.

To approximate a divide by 255 it is possible to multiply by 257 andthen divide by 65536. It can also be achieved by a single add (256*x+x)and ignoring (except for rounding purposes) the final 16 bits of theresult.

As shown in FIG. 42, the compositor process requires 3 Sequential ReadIterators 351-353 and 1 Sequential Write Iterator 355, and isimplemented as microcode using a Adder ALU in conjunction with amultiplier ALU. Composite time is 1 cycle (10 ns) per-pixel. Differentmicrocode is required for associated and regular compositing, althoughthe average time per pixel composite is the same.

The composite process is only run on a single channel. To composite one3-channel image with another, the compositor must be run 3 times, oncefor each channel. As the a channel is the same for each composite, itmust be read each time. However it should be noted that to transfer(read or write) 4×32 byte cache-lines in the best case takes 320 ns. Thepipeline gives an average of 1 cycle per pixel composite, taking 32cycles or 320 ns (at 100 MHz) to composite the 32 pixels, so the achannel is effectively read for free. An entire channel can therefore becomposited in:

1500/32*1000*320 ns=15,040,000 ns=0.015 seconds.

The time taken to composite a full size 3 channel image is therefore0.045 seconds.

Construct Image Pyramid

Several functions, such as warping, tiling and brushing, require theaverage value of a given area of pixels. Rather than calculate the valuefor each area given, these functions preferably make use of an imagepyramid. As illustrated previously in FIG. 33, an image pyramid 360 iseffectively a multi-resolution pixelmap. The original image is a 1:1representation. Sub-sampling by 2:1 in each dimension produces an image¼ the original size. This process continues until the entire image isrepresented by a single pixel.

An image pyramid is constructed from an original image, and consumes ⅓of the size taken up by the original image (¼+ 1/16+ 1/64+ . . . ). Foran original image of 1500×1000 the corresponding image pyramid isapproximately ½ MB

The image pyramid can be constructed via a 3×3 convolve performed on 1in 4 input image pixels advancing the center of the convolve kernel by 2pixels each dimension. A 3×3 convolve results in higher accuracy thansimply averaging 4 pixels, and has the added advantage that coordinateson different pyramid levels differ only by shifting 1 bit per level.

The construction of an entire pyramid relies on a software loop thatcalls the pyramid level construction function once for each level of thepyramid.

The timing to produce 1 level of the pyramid is 9/4*¼ of the resolutionof the input image since we are generating an image ¼ of the size of theoriginal. Thus for a 1500×1000 image:

Timing to produce level 1 of pyramid=9/4*750*500=843, 750 cycles

Timing to produce level 2 of pyramid=9/4*375*250=210, 938 cycles

Timing to produce level 3 of pyramid=9/4*188*125=52, 735 cycles

Etc.

The total time is ¾ cycle per original image pixel (image pyramid is ⅓of original image size, and each pixel takes 9/4 cycles to becalculated, i.e. ⅓*9/4=¾). In the case of a 1500×1000 image is 1,125,000cycles (at 100 MHz), or 0.011 seconds. This timing is for a single colorchannel, 3 color channels require 0.034 seconds processing time.

General Data Driven Image Warper

The ACP 31 is able to carry out image warping manipulations of the inputimage. The principles of image warping are well-known in theory. Onethorough text book reference on the process of warping is “Digital ImageWarping” by George Wolberg published in 1990 by the IEEE ComputerSociety Press, Los Alamitos, California. The warping process utilizes awarp map which forms part of the data fed in via Artcard 9. The warp mapcan be arbitrarily dimensioned in accordance with requirements andprovides information of a mapping of input pixels to output pixels.Unfortunately, the utilization of arbitrarily sized warp maps presents anumber of problems which must be solved by the image warper.

Turning to FIG. 85, a warp map 365, having dimensions A×B comprisesarray values of a certain magnitude (for example 8 bit values from0-255) which set out the coordinate of a theoretical input image whichmaps to the corresponding “theoretical” output image having the samearray coordinate indices. Unfortunately, any output image eg. 366 willhave its own dimensions C×D which may further be totally different froman input image which may have its own dimensions E×F. Hence, it isnecessary to facilitate the remapping of the warp map 365 so that it canbe utilised for output image 366 to determine, for each output pixel,the corresponding area or region of the input image 367 from which theoutput pixel color data is to be constructed. For each output pixel inoutput image 366 it is necessary to first determine a corresponding warpmap value from warp map 365. This may include the need to bilinearlyinterpolate the surrounding warp map values when an output image pixelmaps to a fractional position within warp map table 365. The result ofthis process will give the location of an input image pixel in a“theoretical” image which will be dimensioned by the size of each datavalue within the warp map 365. These values must be re-scaled so as tomap the theoretical image to the corresponding actual input image 367.

In order to determine the actual value and output image pixel shouldtake so as to avoid aliasing effects, adjacent output image pixelsshould be examined to determine a region of input image pixels 367 whichwill contribute to the final output image pixel value. In this respect,the image pyramid is utilised as will become more apparent hereinafter.

The image warper performs several tasks in order to warp an image.

-   -   Scale the warp map to match the output image size.    -   Determine the span of the region of input image pixels        represented in each output pixel.    -   Calculate the final output pixel value via tri-linear        interpolation from the input image pyramid

Scale Warp Map

As noted previously, in a data driven warp, there is the need for a warpmap that describes, for each output pixel, the center of a correspondinginput image map. Instead of having a single warp map as previouslydescribed, containing interleaved x and y value information, it ispossible to treat the X and Y coordinates as separate channels.

Consequently, preferably there are two warp maps: an X warp map showingthe warping of X coordinates, and a Y warp map, showing the warping ofthe Y coordinates. As noted previously, the warp map 365 can have adifferent spatial resolution than the image they being scaled (forexample a 32×32 warp-map 365 may adequately describe a warp for a1500×1000 image 366). In addition, the warp maps can be represented by 8or 16 bit values that correspond to the size of the image being warped.

There are several steps involved in producing points in the input imagespace from a given warp map:

1. Determining the corresponding position in the warp map for the outputpixel

2. Fetch the values from the warp map for the next step (this canrequire scaling in the resolution domain if the warp map is only 8 bitvalues)

3. Bi-linear interpolation of the warp map to determine the actual value

4. Scaling the value to correspond to the input image domain

The first step can be accomplished by multiplying the current X/Ycoordinate in the output image by a scale factor (which can be differentin X & Y). For example, if the output image was 1500×1000, and the warpmap was 150×100, we scale both X & Y by 1/10.

Fetching the values from the warp map requires access to 2 Lookuptables. One Lookup table indexes into the X warp-map, and the otherindexes into the Y warp-map. The lookup table either reads 8 or 16 bitentries from the lookup table, but always returns 16 bit values(clearing the high 8 bits if the original values are only 8 bits).

The next step in the pipeline is to bi-linearly interpolate thelooked-up warp map values.

Finally the result from the bi-linear interpolation is scaled to placeit in the same domain as the image to be warped. Thus, if the warp maprange was 0-255, we scale X by 1500/255, and Y by 1000/255.

The interpolation process is as illustrated in FIG. 86 with thefollowing constants set by software:

Constant Value K₁ Xscale (scales 0-ImageWidth to 0-WarpmapWidth) K₂Yscale (scales 0-ImageHeight to 0-WarpmapHeight) K₃ XrangeScale (scaleswarpmap range (eg 0-255) to 0-ImageWidth) K₄ YrangeScale (scales warpmaprange (eg 0-255) to 0-ImageHeight)

The following lookup table is used:

Lookup Size Details LU₁ and WarpmapWidth × Warpmap lookup. LU₂WarpmapHeight Given [X, Y] the 4 entries required for bi-linearinterpolation are returned. Even if entries are only 8 bit, they arereturned as 16 bit (high 8 bits 0). Transfer time is 4 entries at 2bytes per entry. Total time is 8 cycles as 2 lookups are used.

Span Calculation

The points from the warp map 365 locate centers of pixel regions in theinput image 367. The distance between input image pixels of adjacentoutput image pixels will indicate the size of the regions, and thisdistance can be approximated via a span calculation.

Turning to FIG. 87, for a given current point in the warp map P1, theprevious point on the same line is called P0, and the previous line'spoint at the same position is called P2. We determine the absolutedistance in X & Y between P1 and P0, and between P1 and P2. The maximumdistance in X or Y becomes the span which will be a square approximationof the actual shape.

Preferably, the points are processed in a vertical strip output order,P0 is the previous point on the same line within a strip, and when P1 isthe first point on line within a strip, then PO refers to the last pointin the previous strip's corresponding line. P2 is the previous line'spoint in the same strip, so it can be kept in a 32-entry history buffer.The basic of the calculate span process are as illustrated in FIG. 88with the details of the process as illustrated in FIG. 89.

The following DRAM FIFO is used:

Lookup Size Details FIFO₁ 8 ImageWidth bytes. P2 history/lookup (both X& Y in same [ImageWidth × 2 FIFO) entries at 32 bits per P1 is put intothe FIFO and taken out entry] again at the same pixel on the followingrow as P2. Transfer time is 4 cycles (2 × 32 bits, with 1 cycle per 16bits)

Since a 32 bit precision span history is kept, in the case of a 1500pixel wide image being warped 12,000 bytes temporary storage isrequired.

Calculation of the span 364 uses 2 Adder ALUs (1 for span calculation, 1for looping and counting for P0 and P2 histories) takes 7 cycles asfollows:

Cycle Action 1 A = ABS(P1_(x) − P2_(x)) Store P1_(x) in P2_(x) history 2B = ABS(P1_(x) − P0_(x)) Store P1_(x) in P0_(x) history 3 A = MAX(A, B)4 B = ABS(P1_(y) − P2_(y)) Store P1_(y) in P2_(y) history 5 A = MAX(A,B) 6 B = ABS(P1_(y) − P0_(y)) Store P1_(y) in P0_(y) history 7 A =MAX(A, B)

The history buffers 365, 366 are cached DRAM. The ‘Previous Line’ (forP2 history) buffer 366 is 32 entries of span-precision. The ‘PreviousPoint’ (for P0 history). Buffer 365 requires 1 register that is usedmost of the time (for calculation of points 1 to 31 of a line in astrip), and a DRAM buffered set of history values to be used in thecalculation of point 0 in a strip's line.

32 bit precision in span history requires 4 cache lines to hold P2history, and 2 for P0 history. P0's history is only written and read outonce every 8 lines of 32 pixels to a temporary storage space of(ImageHeight*4) bytes. Thus a 1500 pixel high image being warpedrequires 6000 bytes temporary storage, and a total of 6 cache lines.

Tri-Linear Interpolation

Having determined the center and span of the area from the input imageto be averaged, the final part of the warp process is to determine thevalue of the output pixel. Since a single output pixel couldtheoretically be represented by the entire input image, it ispotentially too time-consuming to actually read and average the specificarea of the input image contributing to the output pixel. Instead, it ispossible to approximate the pixel value by using an image pyramid of theinput image.

If the span is 1 or less, it is necessary only to read the originalimage's pixels around the given coordinate, and perform bi-linearinterpolation. If the span is greater than 1, we must read twoappropriate levels of the image pyramid and perform tri-linearinterpolation. Performing linear interpolation between two levels of theimage pyramid is not strictly correct, but gives acceptable results (iterrs on the side of blurring the resultant image).

Turning to FIG. 90, generally speaking, for a given span ‘s’, it isnecessary to read image pyramid levels given by ln₂s (370) and ln₂s+1(371). Ln₂s is simply decoding the highest set bit of s. We mustbi-linear interpolate to determine the value for the pixel value on eachof the two levels 370,371 of the pyramid, and then interpolate betweenlevels.

As shown in FIG. 91, it is necessary to first interpolate in X and Y foreach pyramid level before interpolating between the pyramid levels toobtain a final output value 373.

The image pyramid address mode issued to generate addresses for pixelcoordinates at (x, y) on pyramid level s & s+1. Each level of the imagepyramid contains pixels sequential in x. Hence, reads in x are likely tobe cache hits.

Reasonable cache coherence can be obtained as local regions in theoutput image are typically locally coherent in the input image (perhapsat a different scale however, but coherent within the scale). Since itis not possible to know the relationship between the input and outputimages, we ensure that output pixels are written in a vertical strip(via a Vertical-Strip Iterator) in order to best make use of cachecoherence.

Tri-linear interpolation can be completed in as few as 2 cycles onaverage using 4 multiply ALUs and all 4 adder ALUs as a pipeline andassuming no memory access required. But since all the interpolationvalues are derived from the image pyramids, interpolation speed iscompletely dependent on cache coherence (not to mention the other unitsare busy doing warp-map scaling and span calculations). As many cachelines as possible should therefore be available to the image-pyramidreading. The best speed will be 8 cycles, using 2 Multiply ALUs.

The output pixels are written out to the DRAM via a Vertical-Strip WriteIterator that uses 2 cache lines. The speed is therefore limited to aminimum of 8 cycles per output pixel. If the scaling of the warp maprequires 8 or fewer cycles, then the overall speed will be unchanged.Otherwise the throughput is the time taken to scale the warp map. Inmost cases the warp map will be scaled up to match the size of thephoto.

Assuming a warp map that requires 8 or fewer cycles per pixel to scale,the time taken to convert a single color component of image is therefore0.12 s (1500*1000*8 cycles*10 ns per cycle).

Histogram Collector

The histogram collector is a microcode program that takes an imagechannel as input, and produces a histogram as output. Each of achannel's pixels has a value in the range 0-255. Consequently there are256 entries in the histogram table, each entry 32 bits—large enough tocontain a count of an entire 1500×1000 image.

As shown in FIG. 92, since the histogram represents a summary of theentire image, a Sequential Read Iterator 378 is sufficient for theinput. The histogram itself can be completely cached, requiring 32 cachelines (1K).

The microcode has two passes: an initialization pass which sets all thecounts to zero, and then a “count” stage that increments the appropriatecounter for each pixel read from the image. The first stage requires theAddress Unit and a single Adder ALU, with the address of the histogramtable 377 for initialising.

Relative Microcode Address Unit Address A = Base address of histogramAdder Unit 1 0 Write 0 to Out1 = A A + (Adder1.Out1 << 2) A = A − 1 BNZ0 1 Rest of processing Rest of processing

The second stage processes the actual pixels from the image, and uses 4Adder ALUs:

Adder 1 Adder 2 Adder 3 Adder 4 Address Unit 1 A = 0 A = −1 2 Out1 = A =A = A = A + 1 Out1 = BZ A Adder1.Out1 Adr.Out1 Read 4 bytes 2 A = Z =pixel − from: (A + pixel Adder1.Out1 (Adder1.Out1 << 2)) 3 Out1 = A Out1= A Out1 = A Write A = Adder4.Out1 Adder3.Out1 to: (A + (Adder2.Out <<2) 4 Write Adder4.Out1 to: (A + (Adder2.Out << 2) Flush caches

The Zero flag from Adder2 cycle 2 is used to stay at microcode address 2for as long as the input pixel is the same. When it changes, the newcount is written out in microcode address 3, and processing resumes atmicrocode address 2. Microcode address 4 is used at the end, when thereare no more pixels to be read.

Stage 1 takes 256 cycles, or 2560 ns. Stage 2 varies according to thevalues of the pixels. The worst case time for lookup table replacementis 2 cycles per image pixel if every pixel is not the same as itsneighbor. The time taken for a single color lookup is 0.03 s(1500×1000×2 cycle per pixel×10 ns per cycle=30,000,000 ns). The timetaken for 3 color components is 3 times this amount, or 0.09 s.

Color Transform

Color transformation is achieved in two main ways:

-   -   Lookup table replacement    -   Color space conversion

Lookup Table Replacement

As illustrated in FIG. 86, one of the simplest ways to transform thecolor of a pixel is to encode an arbitrarily complex transform functioninto a lookup table 380. The component color value of the pixel is usedto lookup 381 the new component value of the pixel. For each pixel readfrom a Sequential Read Iterator, its new value is read from the NewColor Table 380, and written to a Sequential Write Iterator 383. Theinput image can be processed simultaneously in two halves to makeeffective use of memory bandwidth. The following lookup table is used:

Lookup Size Details LU₁ 256 entries Replacement[X] 8 bits per entryTable indexed by the 8 highest significant bits of X. Resultant 8 bitstreated as fixed point 0:8

The total process requires 2 Sequential Read Iterators and 2 SequentialWrite iterators. The 2 New Color Tables require 8 cache lines each tohold the 256 bytes (256 entries of 1 byte).

The average time for lookup table replacement is therefore ½ cycle perimage pixel. The time taken for a single color lookup is 0.0075 s(1500×1000×½ cycle per pixel×10 ns per cycle=7,500,000 ns). The timetaken for 3 color components is 3 times this amount, or 0.0225 s. Eachcolor component has to be processed one after the other under control ofsoftware.

Color Space Conversion

Color Space conversion is only required when moving between colorspaces. The CCD images are captured in RGB color space, and printingoccurs in CMY color space, while clients of the ACP 31 likely processimages in the Lab color space. All of the input color space channels aretypically required as input to determine each output channel's componentvalue. Thus the logical process is as illustrated 385 in FIG. 94.

Simply, conversion between Lab, RGB, and CMY is fairly straightforward.However the individual color profile of a particular device can varyconsiderably. Consequently, to allow future CCDs, inks, and printers,the ACP 31 performs color space conversion by means of tri-linearinterpolation from color space conversion lookup tables.

Color coherence tends to be area based rather than line based. To aidcache coherence during tri-linear interpolation lookups, it is best toprocess an image in vertical strips. Thus the read 386-388 and write 389iterators would be Vertical-Strip Iterators.

Tri-Linear Color Space Conversion

For each output color component, a single 3D table mapping the inputcolor space to the output color component is required. For example, toconvert CCD images from RGB to Lab, 3 tables calibrated to the physicalcharacteristics of the CCD are required:

RGB->L

RGB->a

RGB->b

To convert from Lab to CMY, 3 tables calibrated to the physicalcharacteristics of the ink/printer are required:

Lab->C

Lab->M

Lab->Y

The 8-bit input color components are treated as fixed-point numbers(3:5) in order to index into the conversion tables. The 3 bits ofinteger give the index, and the 5 bits of fraction are used forinterpolation. Since 3 bits gives 8 values, 3 dimensions gives 512entries (8×8×8). The size of each entry is 1 byte, requiring 512 bytesper table.

The Convert Color Space process can therefore be implemented as shown inFIG. 95 and the following lookup table is used:

Lookup Size Details LU₁ 8 × 8 × 8 entries Convert[X, Y, Z] 512 entriesTable indexed by the 3 highest bits of X, Y, 8 bits per entry and Z. 8entries returned from Tri-linear index address unit Resultant 8 bitstreated as fixed point 8:0 Transfer time is 8 entries at 1 byte perentry

Tri-linear interpolation returns interpolation between 8 values. Each 8bit value takes 1 cycle to be returned from the lookup, for a total of 8cycles. The tri-linear interpolation also takes 8 cycles when 2 MultiplyALUs are used per cycle. General tri-linear interpolation information isgiven in the ALU section of this document. The 512 bytes for the lookuptable fits in 16 cache lines.

The time taken to convert a single color component of image is therefore0.105 s (1500*1000*7 cycles*10 ns per cycle). To convert 3 componentstakes 0.415 s. Fortunately, the color space conversion for printouttakes place on the fly during printout itself, so is not a perceiveddelay.

If color components are converted separately, they must not overwritetheir input color space components since all color components from theinput color space are required for converting each component.

Since only 1 multiply unit is used to perform the interpolation, it isalternatively possible to do the entire Lab->CMY conversion as a singlepass. This would require 3 Vertical-Strip Read Iterators, 3Vertical-Strip Write Iterators, and access to 3 conversion tablessimultaneously. In that case, it is possible to write back onto theinput image and thus use no extra memory. However, access to 3conversion tables equals ⅓ of the caching for each, that could lead tohigh latency for the overall process.

Affine Transform

Prior to compositing an image with a photo, it may be necessary torotate, scale and translate it. If the image is only being translated,it can be faster to use a direct sub-pixel translation function.However, rotation, scale-up and translation can all be incorporated intoa single affine transform.

A general affine transform can be included as an accelerated function.Affine transforms are limited to 2D, and if scaling down, input imagesshould be pre-scaled via the Scale function. Having a general affinetransform function allows an output image to be constructed one block ata time, and can reduce the time taken to perform a number oftransformations on an image since all can be applied at the same time.

A transformation matrix needs to be supplied by the client—the matrixshould be the inverse matrix of the transformation desired i.e. applyingthe matrix to the output pixel coordinate will give the inputcoordinate.

A 2D matrix is usually represented as a 3×3 array:

$\begin{bmatrix}a & b & 0 \\c & d & 0 \\e & f & 1\end{bmatrix}\quad$

Since the 3^(rd) column is always[0, 0, 1] clients do not need tospecify it. Clients instead specify a, b, c, d, e, and f.

Given a coordinate in the output image (x, y) whose top left pixelcoordinate is given as (0, 0), the input coordinate is specified by:(ax+cy+e, bx+dy+f). Once the input coordinate is determined, the inputimage is sampled to arrive at the pixel value. Bi-linear interpolationof input image pixels is used to determine the value of the pixel at thecalculated coordinate. Since affine transforms preserve parallel lines,images are processed in output vertical strips of 32 pixels wide forbest average input image cache coherence.

Three Multiply ALUs are required to perform the bi-linear interpolationin 2 cycles. Multiply ALUs 1 and 2 do linear interpolation in X forlines Y and Y+1 respectively, and Multiply ALU 3 does linearinterpolation in Y between the values output by Multiply ALUs 1 and 2.

As we move to the right across an output line in X, 2 Adder ALUscalculate the actual input image coordinates by adding ‘a’ to thecurrent X value, and ‘b’ to the current Y value respectively. When weadvance to the next line (either the next line in a vertical strip afterprocessing a maximum of 32 pixels, or to the first line in a newvertical strip) we update X and Y to pre-calculated start coordinatevalues constants for the given block

The process for calculating an input coordinate is given in FIG. 96where the following constants are set by software:

Calculate Pixel

Once we have the input image coordinates, the input image must besampled. A lookup table is used to return the values at the specifiedcoordinates in readiness for bilinear interpolation. The basic processis as indicated in FIG. 97 and the following lookup table is used:

Lookup Size Details LU₁ Image Bilinear Image lookup [X, Y] width byTable indexed by the integer part of X and Y. Image 4 entries returnedfrom Bilinear index address unit, height 2 per cycle. 8 bits per Each 8bit entry treated as fixed point 8:0 entry Transfer time is 2 cycles (216 bit entries in FIFO hold the 4 8 bit entries)

The affine transform requires all 4 Multiply Units and all 4 Adder ALUs,and with good cache coherence can perform an affine transform with anaverage of 2 cycles per output pixel. This timing assumes good cachecoherence, which is true for non-skewed images. Worst case timings areseverely skewed images, which meaningful Vark scripts are unlikely tocontain.

The time taken to transform a 128×128 image is therefore 0.00033 seconds(32,768 cycles). If this is a clip image with 4 channels (including achannel), the total time taken is 0.00131 seconds (131,072 cycles).

A Vertical-Strip Write Iterator is required to output the pixels. NoRead Iterator is required.

However, since the affine transform accelerator is bound by time takento access input image pixels, as many cache lines as possible should beallocated to the read of pixels from the input image. At least 32 shouldbe available, and preferably 64 or more.

Scaling

Scaling is essentially a re-sampling of an image. Scale up of an imagecan be performed using the Affine Transform function. Generalizedscaling of an image, including scale down, is performed by the hardwareaccelerated Scale function. Scaling is performed independently in X andY, so different scale factors can be used in each dimension.

The generalized scale unit must match the Affine Transform scalefunction in terms of registration. The generalized scaling process is asillustrated in FIG. 98. The scale in X is accomplished by Fant'sre-sampling algorithm as illustrated in FIG. 99.

Where the following constants are set by software:

Constant Value K₁ Number of input pixels that contribute to an outputpixel in X K₂ 1/K₁

The following registers are used to hold temporary variables:

Variable Value Latch₁ Amount of input pixel remaining unused (starts at1 and decrements) Latch₂ Amount of input pixels remaining to contributeto current output pixel (starts at K₁ and decrements) Latch₃ Next pixel(in X) Latch₄ Current pixel Latch₅ Accumulator for output pixel(unscaled) Latch₆ Pixel Scaled in X (output)

The Scale in Y process is illustrated in FIG. 100 and is alsoaccomplished by a slightly altered version of Fant's re-samplingalgorithm to account for processing in order of X pixels.

Where the following constants are set by software:

Constant Value K₁ Number of input pixels that contribute to an outputpixel in Y K₂ 1/K₁

The following registers are used to hold temporary variables:

Variable Value Latch₁ Amount of input pixel remaining unused (starts at1 and decrements) Latch₂ Amount of input pixels remaining to contributeto current output pixel (starts at K₁ and decrements) Latch₃ Next pixel(in Y) Latch₄ Current pixel Latch₅ Pixel Scaled in Y (output)

The following DRAM FIFOs are used:

Lookup Size Details FIFO₁ ImageWidth_(OUT) entries 1 row of image pixelsalready scaled 8 bits per entry in X 1 cycle transfer time FIFO₂ImageWidth_(OUT) entries 1 row of image pixels already scaled 16 bitsper entry in X 2 cycles transfer time (1 byte per cycle)

Tessellate Image

Tessellation of an image is a form of tiling. It involves copying aspecially designed “tile” multiple times horizontally and verticallyinto a second (usually larger) image space. When tessellated, the smalltile forms a seamless picture. One example of this is a small tile of asection of a brick wall. It is designed so that when tessellated, itforms a full brick wall. Note that there is no scaling or sub-pixeltranslation involved in tessellation.

The most cache-coherent way to perform tessellation is to output theimage sequentially line by line, and to repeat the same line of theinput image for the duration of the line. When we finish the line, theinput image must also advance to the next line (and repeat it multipletimes across the output line).

An overview of the tessellation function is illustrated 390 in FIG. 101.The Sequential Read Iterator 392 is set up to continuously read a singleline of the input tile (StartLine would be 0 and EndLine would be 1).Each input pixel is written to all 3 of the Write Iterators 393-395. Acounter 397 in an Adder ALU counts down the number of pixels in anoutput line, terminating the sequence at the end of the line.

At the end of processing a line, a small software routine updates theSequential Read Iterator's StartLine and EndLine registers beforerestarting the microcode and the Sequential Read Iterator (which clearsthe FIFO and repeats line 2 of the tile). The Write Iterators 393-395are not updated, and simply keep on writing out to their respectiveparts of the output image. The net effect is that the tile has one linerepeated across an output line, and then the tile is repeated verticallytoo.

This process does not fully use the memory bandwidth since we get goodcache coherence in the input image, but it does allow the tessellationto function with tiles of any size. The process uses 1 Adder ALU. If the3 Write Iterators 393-395 each write to ⅓ of the image (breaking theimage on tile sized boundaries), then the entire tessellation processtakes place at an average speed of ⅓ cycle per output image pixel. Foran image of 1500×1000, this equates to 0.005 seconds (5,000,000 ns).

Sub-Pixel Translator

Before compositing an image with a background, it may be necessary totranslate it by a sub-pixel amount in both X and Y. Sub-pixel transformscan increase an image's size by 1 pixel in each dimension. The value ofthe region outside the image can be client determined, such as aconstant value (e.g. black), or edge pixel replication. Typically itwill be better to use black.

The sub-pixel translation process is as illustrated in FIG. 102.Sub-pixel translation in a given dimension is defined by:

Pixel_(out)=Pixel_(in)*(1−Translation)+Pixel_(in-1)*Translation

It can also be represented as a form of interpolation:

Pixel_(out)=Pixel_(in-1)+(Pixel_(in)−Pixel_(in-1))*Translation

Implementation of a single (on average) cycle interpolation engine usinga single Multiply ALU and a single Adder ALU in conjunction isstraightforward. Sub-pixel translation in both X & Y requires 2interpolation engines.

In order to sub-pixel translate in Y, 2 Sequential Read Iterators 400,401 are required (one is reading a line ahead of the other from the sameimage), and a single Sequential Write Iterator 403 is required.

The first interpolation engine (interpolation in Y) accepts pairs ofdata from 2 streams, and linearly interpolates between them. The secondinterpolation engine (interpolation in X) accepts its data as a single 1dimensional stream and linearly interpolates between values. Bothengines interpolate in 1 cycle on average.

Each interpolation engine 405, 406 is capable of performing thesub-pixel translation in 1 cycle per output pixel on average. Theoverall time is therefore 1 cycle per output pixel, with requirements of2 Multiply ALUs and 2 Adder ALUs.

The time taken to output 32 pixels from the sub-pixel translate functionis on average 320 ns (32 cycles). This is enough time for 4 fullcache-line accesses to DRAM, so the use of 3 Sequential Iterators iswell within timing limits.

The total time taken to sub-pixel translate an image is therefore 1cycle per pixel of the output image. A typical image to be sub-pixeltranslated is a tile of size 128*128. The output image size is 129*129.The process takes 129*129*10 ns=166,410 ns.

The Image Tiler function also makes use of the sub-pixel translationalgorithm, but does not require the writing out of thesub-pixel-translated data, but rather processes it further.

Image Tiler

The high level algorithm for tiling an image is carried out in software.Once the placement of the tile has been determined, the appropriatecolored tile must be composited. The actual compositing of each tileonto an image is carried out in hardware via the microcoded ALUs.Compositing a tile involves both a texture application and a colorapplication to a background image. In some cases it is desirable tocompare the actual amount of texture added to the background in relationto the intended amount of texture, and use this to scale the color beingapplied. In these cases the texture must be applied first.

Since color application functionality and texture applicationfunctionality are somewhat independent, they are separated intosub-functions.

The number of cycles per 4-channel tile composite for the differenttexture styles and coloring styles is summarised in the following table:

Constant Pixel color color Replace texture 4 4.75 25% background + tiletexture 4 4.75 Average height algorithm 5 5.75 Average height algorithmwith feedback 5.75 6.5

Tile Coloring and Compositing

A tile is set to have either a constant color (for the whole tile), ortakes each pixel value from an input image. Both of these cases may alsohave feedback from a texturing stage to scale the opacity (similar tothinning paint).

The steps for the 4 cases can be summarised as:

-   -   Sub-pixel translate the tile's opacity values,    -   Optionally scale the tile's opacity (if feedback from texture        application is enabled).    -   Determine the color of the pixel (constant or from an image        map).    -   Composite the pixel onto the background image.

Each of the 4 cases is treated separately, in order to minimize the timetaken to perform the function. The summary of time per color compositingstyle for a single color channel is described in the following table:

Feedback from No feedback texture from texture (cycles per Tiling colorstyle (cycles per pixel) pixel) Tile has constant color per pixel 1 2Tile has per pixel color from input 1.25 2 image

Constant Color

In this case, the tile has a constant color, determined by software.While the ACP 31 is placing down one tile, the software can bedetermining the placement and coloring of the next tile.

The color of the tile can be determined by bi-linear interpolation intoa scaled version of the image being tiled. The scaled version of theimage can be created and stored in place of the image pyramid, and needsonly to be performed once per entire tile operation. If the tile size is128×128, then the image can be scaled down by 128:1 in each dimension.

Without Feedback

When there is no feedback from the texturing of a tile, the tile issimply placed at the specified coordinates. The tile color is used foreach pixel's color, and the opacity for the composite comes from thetile's sub-pixel translated opacity channel. In this case color channelsand the texture channel can be processed completely independentlybetween tiling passes.

The overview of the process is illustrated in FIG. 103. Sub-pixeltranslation 410 of a tile can be accomplished using 2 Multiply ALUs and2 Adder ALUs in an average time of 1 cycle per output pixel. The outputfrom the sub-pixel translation is the mask to be used in compositing 411the constant tile color 412 with the background image from backgroundsequential Read Iterator.

Compositing can be performed using 1 Multiply ALU and 1 Adder ALU in anaverage time of 1 cycle per composite. Requirements are therefore 3Multiply ALUs and 3 Adder ALUs. 4 Sequential Iterators 413-416 arerequired, taking 320 ns to read or write their contents. With an averagenumber of cycles of 1 per pixel to sub-pixel translate and composite,there is sufficient time to read and write the buffers.

With Feedback

When there is feedback from the texturing of a tile, the tile is placedat the specified coordinates. The tile color is used for each pixel'scolor, and the opacity for the composite comes from the tile's sub-pixeltranslated opacity channel scaled by the feedback parameter. Thus thetexture values must be calculated before the color value is applied.

The overview of the process is illustrated in FIG. 97. Sub-pixeltranslation of a tile can be accomplished using 2 Multiply ALUs and 2Adder ALUs in an average time of 1 cycle per output pixel. The outputfrom the sub-pixel translation is the mask to be scaled according to thefeedback read from the Feedback Sequential Read Iterator 420. Thefeedback is passed it to a Scaler (1 Multiply ALU) 421.

Compositing 422 can be performed using 1 Multiply ALU and 1 Adder ALU inan average time of 1 cycle per composite. Requirements are therefore 4Multiply ALUs and all 4 Adder ALUs. Although the entire process can beaccomplished in 1 cycle on average, the bottleneck is the memory access,since 5 Sequential Iterators are required. With sufficient buffering,the average time is 1.25 cycles per pixel.

Color from Input Image

One way of coloring pixels in a tile is to take the color from pixels inan input image. Again, there are two possibilities for compositing: withand without feedback from the texturing.

Without Feedback

In this case, the tile color simply comes from the relative pixel in theinput image. The opacity for compositing comes from the tile's opacitychannel sub-pixel shifted.

The overview of the process is illustrated in FIG. 105. Sub-pixeltranslation 425 of a tile can be accomplished using 2 Multiply ALUs and2 Adder ALUs in an average time of 1 cycle per output pixel. The outputfrom the sub-pixel translation is the mask to be used in compositing 426the tile's pixel color (read from the input image 428) with thebackground image 429.

Compositing 426 can be performed using 1 Multiply ALU and 1 Adder ALU inan average time of 1 cycle per composite. Requirements are therefore 3Multiply ALUs and 3 Adder ALUs. Although the entire process can beaccomplished in 1 cycle on average, the bottleneck is the memory access,since 5 Sequential Iterators are required. With sufficient buffering,the average time is 1.25 cycles per pixel.

With Feedback

In this case, the tile color still comes from the relative pixel in theinput image, but the opacity for compositing is affected by the relativeamount of texture height actually applied during the texturing pass.This process is as illustrated in FIG. 106.

Sub-pixel translation 431 of a tile can be accomplished using 2 MultiplyALUs and 2 Adder ALUs in an average time of 1 cycle per output pixel.The output from the sub-pixel translation is the mask to be scaled 431according to the feedback read from the Feedback Sequential ReadIterator 432. The feedback is passed to a Scaler (1 Multiply ALU) 431.

Compositing 434 can be performed using 1 Multiply ALU and 1 Adder ALU inan average time of 1 cycle per composite.

Requirements are therefore all 4 Multiply ALUs and 3 Adder ALUs.Although the entire process can be accomplished in 1 cycle on average,the bottleneck is the memory access, since 6 Sequential Iterators arerequired. With sufficient buffering, the average time is 1.5 cycles perpixel.

Tile Texturing

Each tile has a surface texture defined by its texture channel. Thetexture must be sub-pixel translated and then applied to the outputimage. There are 3 styles of texture compositing:

-   -   Replace texture    -   25% background+tile's texture    -   Average height algorithm

In addition, the Average height algorithm can save feedback parametersfor color compositing.

The time taken per texture compositing style is summarised in thefollowing table:

Cycles per pixel Cycles per pixel (no feedback from (feedback fromTiling color style texture) texture) Replace texture 1 — 25%background + tile texture 1 — value Average height algorithm 2 2

Replace Texture

In this instance, the texture from the tile replaces the texture channelof the image, as illustrated in FIG. 107. Sub-pixel translation 436 of atile's texture can be accomplished using 2 Multiply ALUs and 2 AdderALUs in an average time of 1 cycle per output pixel. The output fromthis sub-pixel translation is fed directly to the Sequential WriteIterator 437.

The time taken for replace texture compositing is 1 cycle per pixel.There is no feedback, since 100% of the texture value is always appliedto the background. There is therefore no requirement for processing thechannels in any particular order.

25% Background+Tile's Texture

In this instance, the texture from the tile is added to 25% of theexisting texture value. The new value must be greater than or equal tothe original value. In addition, the new texture value must be clippedat 255 since the texture channel is only 8 bits. The process utilised isillustrated in FIG. 108.

Sub-pixel translation 440 of a tile's texture can be accomplished using2 Multiply ALUs and 2 Adder ALUs in an average time of 1 cycle peroutput pixel. The output from this sub-pixel translation 440 is fed toan adder 441 where it is added to ¼ 442 of the background texture value.Min and Max functions 444 are provided by the 2 adders not used forsub-pixel translation and the output written to a Sequential WriteIterator 445.

The time taken for this style of texture compositing is 1 cycle perpixel. There is no feedback, since 100% of the texture value isconsidered to have been applied to the background (even if clipping at255 occurred). There is therefore no requirement for processing thechannels in any particular order.

Average Height Algorithm

In this texture application algorithm, the average height under the tileis computed, and each pixel's height is compared to the average height.If the pixel's height is less than the average, the stroke height isadded to the background height. If the pixel's height is greater than orequal to the average, then the stroke height is added to the averageheight. Thus background peaks thin the stroke. The height is constrainedto increase by a minimum amount to prevent the background from thinningthe stroke application to 0 (the minimum amount can be 0 however). Theheight is also clipped at 255 due to the 8-bit resolution of the texturechannel.

There can be feedback of the difference in texture applied versus theexpected amount applied. The feedback amount can be used as a scalefactor in the application of the tile's color.

In both cases, the average texture is provided by software, calculatedby performing a bi-level interpolation on a scaled version of thetexture map. Software determines the next tile's average texture heightwhile the current tile is being applied. Software must also provide theminimum thickness for addition, which is typically constant for theentire tiling process.

Without Feedback

With no feedback, the texture is simply applied to the backgroundtexture, as shown in FIG. 109.

4 Sequential Iterators are required, which means that if the process canbe pipelined for 1 cycle, the memory is fast enough to keep up.

Sub-pixel translation 450 of a tile's texture can be accomplished using2 Multiply ALUs and 2 Adder ALUs in an average time of 1 cycle peroutput pixel. Each Min & Max function 451,452 requires a separate AdderALU in order to complete the entire operation in 1 cycle. Since 2 arealready used by the sub-pixel translation of the texture, there are notenough remaining for a 1 cycle average time.

The average time for processing 1 pixel's texture is therefore 2 cycles.Note that there is no feedback, and hence the color channel order ofcompositing is irrelevant.

With Feedback

This is conceptually the same as the case without feedback, except thatin addition to the standard processing of the texture applicationalgorithm, it is necessary to also record the proportion of the textureactually applied. The proportion can be used as a scale factor forsubsequent compositing of the tile's color onto the background image. Aflow diagram is illustrated in FIG. 110 and the following lookup tableis used:

Lookup Size Details LU₁ 256 entries 1/N 16 bits per entry Table indexedby N (range 0-255) Resultant 16 bits treated as fixed point 0:16

Each of the 256 entries in the software provided 1/N table 460 is 16bits, thus requiring 16 cache lines to hold continuously.

Sub-pixel translation 461 of a tile's texture can be accomplished using2 Multiply ALUs and 2 Adder ALUs in an average time of 1 cycle peroutput pixel. Each Min 462 & Max 463 function requires a separate AdderALU in order to complete the entire operation in 1 cycle. Since 2 arealready used by the sub-pixel translation of the texture, there are notenough remaining for a 1 cycle average time.

The average time for processing 1 pixel's texture is therefore 2 cycles.Sufficient space must be allocated for the feedback data area (a tilesized image channel). The texture must be applied before the tile'scolor is applied, since the feedback is used in scaling the tile'sopacity.

CCD Image Interpolator

Images obtained from the CCD via the ISI 83 (FIG. 3) are 750×500 pixels.When the image is captured via the ISI, the orientation of the camera isused to rotate the pixels by 0, 90, 180, or 270 degrees so that the topof the image corresponds to ‘up’. Since every pixel only has an R, G, orB color component (rather than all 3), the fact that these have beenrotated must be taken into account when interpreting the pixel values.Depending on the orientation of the camera, each 2×2 pixel block has oneof the configurations illustrated in FIG. 111:

Several processes need to be performed on the CCD captured image inorder to transform it into a useful form for processing:

-   -   Up-interpolation of low-sample rate color components in CCD        image (interpreting correct orientation of pixels)

Color Conversion from RGB to the Internal Color Space

-   -   Scaling of the internal space image from 750×500 to 1500×1000.    -   Writing out the image in a planar format

The entire channel of an image is required to be available at the sametime in order to allow warping. In a low memory model (8 MB), there isonly enough space to hold a single channel at full resolution as atemporary object. Thus the color conversion is to a single colorchannel. The limiting factor on the process is the color conversion, asit involves tri-linear interpolation from RGB to the internal colorspace, a process that takes 0.026 ns per channel (750×500×7 cycles perpixel×10 ns per cycle=26,250,000 ns).

It is important to perform the color conversion before scaling of theinternal color space image as this reduces the number of pixels scaled(and hence the overall process time) by a factor of 4.

The requirements for all of the transformations may not fit in the ALUscheme. The transformations are therefore broken into two phases:

Phase 1: Up-interpolation of low-sample rate color components in CCDimage (interpreting correct orientation of pixels)

Color Conversion from RGB to the Internal Color Space

Writing Out the Image in a Planar Format

Phase 2: Scaling of the internal space image from 750×500 to 1500×1000

Separating out the scale function implies that the small color convertedimage must be in memory at the same time as the large one. The outputfrom Phase 1 (0.5 MB) can be safely written to the memory area usuallykept for the image pyramid (1 MB). The output from Phase 2 can be thegeneral expanded CCD image. Separation of the scaling also allows thescaling to be accomplished by the Affine Transform, and also allows fora different CCD resolution that may not be a simple 1:2 expansion.

Phase 1: Up-Interpolation of Low-Sample Rate Color Components.

Each of the 3 color components (R, G, and B) needs to be up interpolatedin order for color conversion to take place for a given pixel. We have 7cycles to perform the interpolation per pixel since the color conversiontakes 7 cycles.

Interpolation of G is straightforward and is illustrated in FIG. 112.Depending on orientation, the actual pixel value G alternates betweenodd pixels on odd lines & even pixels on even lines, and odd pixels oneven lines & even pixels on odd lines. In both cases, linearinterpolation is all that is required. Interpolation of R and Bcomponents as illustrated in FIG. 113 and FIG. 113, is more complicated,since in the horizontal and vertical directions, as can be seen from thediagrams, access to 3 rows of pixels simultaneously is required, so 3Sequential Read Iterators are required, each one offset by a single row.In addition, we have access to the previous pixel on the same row via alatch for each row.

Each pixel therefore contains one component from the CCD, and the other2 up-interpolated. When one component is being bi-linearly interpolated,the other is being linearly interpolated. Since the interpolation factoris a constant 0.5, interpolation can be calculated by an add and a shift1 bit right (in 1 cycle), and bi-linear interpolation of factor 0.5 canbe calculated by 3 adds and a shift 2 bits right (3 cycles). The totalnumber of cycles required is therefore 4, using a single multiply ALU.

FIG. 115 illustrates the case for rotation 0 even line even pixel (EL,EP), and odd line odd pixel (OL, OP) and FIG. 116 illustrates the casefor rotation 0 even line odd pixel (EL, OP), and odd line even pixel(OL, EP). The other rotations are simply different forms of these twoexpressions.

Color Conversion

Color space conversion from RGB to Lab is achieved using the same methodas that described in the general Color Space Convert function, a processthat takes 8 cycles per pixel. Phase 1 processing can be described withreference to FIG. 117.

The up-interpolate of the RGB takes 4 cycles (1 Multiply ALU), but theconversion of the color space takes 8 cycles per pixel (2 Multiply ALUs)due to the lookup transfer time.

Phase 2 Scaling the Image

This phase is concerned with up-interpolating the image from the CCDresolution (750×500) to the working photo resolution (1500×1000).Scaling is accomplished by running the Affine transform with a scale of1:2. The timing of a general affine transform is 2 cycles per outputpixel, which in this case means an elapsed scaling time of 0.03 seconds.

Print Head 44

FIG. 153 illustrates the logical layout of a single print Head whichlogically consists of 8 segments, each printing bi-level cyan, magenta,and yellow onto a portion of the page.

Loading a Segment for Printing

Before anything can be printed, each of the 8 segments in the Print Headmust be loaded with 6 rows of data corresponding to the followingrelative rows in the final output image:

Row 0=Line N, Yellow, even dots 0, 2, 4, 6, 8, . . .

Row 1=Line N+8, Yellow, odd dots 1, 3, 5, 7, . . .

Row 2=Line N+10, Magenta, even dots 0, 2, 4, 6, 8, . . .

Row 3=Line N+18, Magenta, odd dots 1, 3, 5, 7, . . .

Row 4=Line N+20, Cyan, even dots 0, 2, 4, 6, 8, . . .

Row 5=Line N+28, Cyan, odd dots 1, 3, 5, 7, . . .

Each of the segments prints dots over different parts of the page. Eachsegment prints 750 dots of one color, 375 even dots on one row, and 375odd dots on another. The 8 segments have dots corresponding topositions:

Segment First dot Last dot 0 0 749 1 750 1499 2 1500 2249 3 2250 2999 43000 3749 5 3750 4499 6 4500 5249 7 5250 5999

Each dot is represented in the Print Head segment by a single bit. Thedata must be loaded 1 bit at a time by placing the data on the segment'sBitValue pin, and clocked in to a shift register in the segmentaccording to a BitClock. Since the data is loaded into a shift register,the order of loading bits must be correct. Data can be clocked in to thePrint Head at a maximum rate of 10 MHz.

Once all the bits have been loaded, they must be transferred in parallelto the Print Head output buffer, ready for printing. The transfer isaccomplished by a single pulse on the segment's ParallelXferClock pin.

Controlling the Print

In order to conserve power, not all the dots of the Print Head have tobe printed simultaneously. A set of control lines enables the printingof specific dots. An external controller, such as the ACP, can changethe number of dots printed at once, as well as the duration of the printpulse in accordance with speed and/or power requirements.

Each segment has 5 NozzleSelect lines, which are decoded to select 32sets of nozzles per row. Since each row has 375 nozzles, each setcontains 12 nozzles. There are also 2 BankEnable lines, one for each ofthe odd and even rows of color. Finally, each segment has 3 ColorEnablelines, one for each of C, M, and Y colors. A pulse on one of theColorEnable lines causes the specified nozzles of the color's specifiedrows to be printed. A pulse is typically about 2 s in duration.

If all the segments are controlled by the same set of NozzleSelect,BankEnable and ColorEnable lines (wired externally to the print head),the following is true:

If both odd and even banks print simultaneously (both BankEnable bitsare set), 24 nozzles fire simultaneously per segment, 192 nozzles inall, consuming 5.7 Watts.

If odd and even banks print independently, only 12 nozzles firesimultaneously per segment, 96 in all, consuming 2.85 Watts.

Print Head Interface 62

The Print Head Interface 62 connects the ACP to the Print Head,providing both data and appropriate signals to the external Print Head.The Print Head Interface 62 works in conjunction with both a VLIWprocessor 74 and a software algorithm running on the CPU in order toprint a photo in approximately 2 seconds.

An overview of the inputs and outputs to the Print Head Interface isshown in FIG. 119. The Address and Data Buses are used by the CPU toaddress the various registers in the Print Head Interface. A singleBitClock output line connects to all 8 segments on the print head. The 8DataBits lines lead one to each segment, and are clocked in to the 8segments on the print head simultaneously (on a BitClock pulse). Forexample, dot 0 is transferred to segment₀, dot 750 is transferred tosegment₁, dot 1500 to segment₂ etc. simultaneously.

The VLIW Output FIFO contains the dithered bi-level C, M, and Y6000×9000 resolution print image in the correct order for output to the8 DataBits. The ParallelXferClock is connected to each of the 8 segmentson the print head, so that on a single pulse, all segments transfertheir bits at the same time. Finally, the NozzleSelect, BankEnable andColorEnable lines are connected to each of the 8 segments, allowing thePrint Head Interface to control the duration of the C, M, and Y droppulses as well as how many drops are printed with each pulse. Registersin the Print Head Interface allow the specification of pulse durationsbetween 0 and 6 μs, with a typical duration of 2 μs.

Printing an Image

There are 2 phases that must occur before an image is in the hand of theArtcam user:

-   -   1. Preparation of the image to be printed    -   2. Printing the prepared image

Preparation of an image only needs to be performed once. Printing theimage can be performed as many times as desired.

Prepare the Image

Preparing an image for printing involves:

-   -   1. Convert the Photo Image into a Print Image    -   2. Rotation of the Print Image (internal color space) to align        the output for the orientation of the printer    -   3. Up-interpolation of compressed channels (if necessary)    -   4. Color conversion from the internal color space to the CMY        color space appropriate to the specific printer and ink

At the end of image preparation, a 4.5 MB correctly oriented 1000×1500CMY image is ready to be printed.

Convert Photo Image to Print Image

The conversion of a Photo Image into a Print Image requires theexecution of a Vark script to perform image processing. The script iseither a default image enhancement script or a Vark script taken fromthe currently inserted Artcard. The Vark script is executed via the CPU,accelerated by functions performed by the VLIW Vector Processor.

Rotate the Print Image

The image in memory is originally oriented to be top upwards. Thisallows for straightforward Vark processing. Before the image is printed,it must be aligned with the print roll's orientation. The re-alignmentonly needs to be done once. Subsequent Prints of a Print Image willalready have been rotated appropriately.

The transformation to be applied is simply the inverse of that appliedduring capture from the CCD when the user pressed the “Image Capture”button on the Artcam. If the original rotation was 0, then notransformation needs to take place. If the original rotation was +90degrees, then the rotation before printing needs to be −90 degrees (sameas 270 degrees). The method used to apply the rotation is the Varkaccelerated Affine Transform function. The Affine Transform engine canbe called to rotate each color channel independently. Note that thecolor channels cannot be rotated in place. Instead, they can make use ofthe space previously used for the expanded single channel (1.5 MB).

FIG. 120 shows an example of rotation of a Lab image where the a and bchannels are compressed 4:1. The L channel is rotated into the space nolonger required (the single channel area), then the a channel can berotated into the space left vacant by L, and finally the b channel canbe rotated. The total time to rotate the 3 channels is 0.09 seconds. Itis an acceptable period of time to elapse before the first print image.Subsequent prints do not incur this overhead.

Up Interpolate and Color Convert

The Lab image must be converted to CMY before printing. Differentprocessing occurs depending on whether the a and b channels of the Labimage is compressed. If the Lab image is compressed, the a and bchannels must be decompressed before the color conversion occurs. If theLab image is not compressed, the color conversion is the only necessarystep. The Lab image must be up interpolated (if the a and b channels arecompressed) and converted into a CMY image. A single VLIW processcombining scale and color transform can be used.

The method used to perform the color conversion is the Vark acceleratedColor Convert function. The Affine Transform engine can be called torotate each color channel independently. The color channels cannot berotated in place. Instead, they can make use of the space previouslyused for the expanded single channel (1.5 MB).

Print the Image

Printing an image is concerned with taking a correctly oriented1000×1500 CMY image, and generating data and signals to be sent to theexternal Print Head. The process involves the CPU working in conjunctionwith a VLIW process and the Print Head Interface.

The resolution of the image in the Artcam is 1000×1500. The printedimage has a resolution of 6000×9000 dots, which makes for a verystraightforward relationship: 1 pixel=6×6=36 dots. As shown in FIG. 121since each dot is 16.6 μm, the 6×6 dot square is 100 μm square. Sinceeach of the dots is bi-level, the output must be dithered.

The image should be printed in approximately 2 seconds. For 9000 rows ofdots this implies a time of 222 μs time between printing each row. ThePrint Head Interface must generate the 6000 dots in this time, anaverage of 37 ns per dot. However, each dot comprises 3 colors, so thePrint Head Interface must generate each color component in approximately12 ns, or 1 clock cycle of the ACP (10 ns at 100 MHz). One VLIW processis responsible for calculating the next line of 6000 dots to be printed.The odd and even C, M, and Y dots are generated by dithering input from6 different 1000×1500 CMY image lines. The second VLIW process isresponsible for taking the previously calculated line of 6000 dots, andcorrectly generating the 8 bits of data for the 8 segments to betransferred by the Print Head Interface to the Print Head in a singletransfer.

A CPU process updates registers in the first VLIW process 3 times perprint line (once per color component=27000 times in 2 seconds0, and inthe 2nd VLIW process once every print line (9000 times in 2 seconds).The CPU works one line ahead of the VLIW process in order to do this.

Finally, the Print Head Interface takes the 8 bit data from the VLIWOutput FIFO, and outputs it unchanged to the Print Head, producing theBitClock signals appropriately. Once all the data has been transferred aParallelXferClock signal is generated to load the data for the nextprint line. In conjunction with transferring the data to the Print Head,a separate timer is generating the signals for the different printcycles of the Print Head using the NozzleSelect, ColorEnable, andBankEnable lines a specified by Print Head Interface internal registers.

The CPU also controls the various motors and guillotine via the parallelinterface during the print process.

Generate C, M, and Y Dots

The input to this process is a 1000×1500 CMY image correctly orientedfor printing. The image is not compressed in any way. As illustrated inFIG. 122, a VLIW microcode program takes the CMY image, and generatesthe C, M, and Y pixels required by the Print Head Interface to bedithered.

The process is run 3 times, once for each of the 3 color components. Theprocess consists of 2 sub-processes run in parallel—one for producingeven dots, and the other for producing odd dots. Each sub-process takesone pixel from the input image, and produces 3 output dots (since onepixel=6 output dots, and each sub-process is concerned with either evenor odd dots). Thus one output dot is generated each cycle, but an inputpixel is only read once every 3 cycles.

The original dither cell is a 64×64 cell, with each entry 8 bits. Thisoriginal cell is divided into an odd cell and an even cell, so that eachis still 64 high, but only 32 entries wide. The even dither cellcontains original dither cell pixels 0, 2, 4 etc., while the oddcontains original dither cell pixels 1, 3, 5 etc. Since a dither cellrepeats across a line, a single 32 byte line of each of the 2 dithercells is required during an entire line, and can therefore be completelycached. The odd and even lines of a single process line are staggered 8dot lines apart, so it is convenient to rotate the odd dither cell'slines by 8 lines. Therefore the same offset into both odd and evendither cells can be used. Consequently the even dither cell's linecorresponds to the even entries of line L in the original dither cell,and the even dither cell's line corresponds to the odd entries of lineL+8 in the original dither cell.

The process is run 3 times, once for each of the color components. TheCPU software routine must ensure that the Sequential Read Iterators forodd and even lines are pointing to the correct image lines correspondingto the print heads. For example, to produce one set of 18,000 dots (3sets of 6000 dots):

Yellow even dot line=0, therefore input Yellow image line=0/6=0

Yellow odd dot line=8, therefore input Yellow image line=8/6=1

Magenta even line=10, therefore input Magenta image line=10/6=1

Magenta odd line=18, therefore input Magenta image line=18/6=3

Cyan even line=20, therefore input Cyan image line=20/6=3

Cyan odd line=28, therefore input Cyan image line=28/6=4

Subsequent sets of input image lines are:

Y=[0, 1], M=[1, 3], C=[3, 4]

Y=[0, 1], M=[1, 3], C=[3, 4]

Y=[0, 1], M=[2, 3], C=[3, 5]

Y=[0, 1], M=[2, 3], C=[3, 5]

Y=[0, 2], M=[2, 3], C=[4, 5]

The dither cell data however, does not need to be updated for each colorcomponent. The dither cell for the 3 colors becomes the same, but offsetby 2 dot lines for each component.

The Dithered Output is written to a Sequential Write Iterator, with oddand even dithered dots written to 2 separate outputs. The same two WriteIterators are used for all 3 color components, so that they arecontiguous within the break-up of odd and even dots.

While one set of dots is being generated for a print line, thepreviously generated set of dots is being merged by a second VLIWprocess as described in the next section.

Generate Merged 8 Bit Dot Output

This process, as illustrated in FIG. 123, takes a single line ofdithered dots and generates the 8 bit data stream for output to thePrint Head Interface via the VLIW Output FIFO. The process requires theentire line to have been prepared, since it requires semi-random accessto most of the dithered line at once. The following constant is set bysoftware:

Constant Value K₁ 375

The Sequential Read Iterators point to the line of previously generateddots, with the Iterator registers set up to limit access to a singlecolor component. The distance between subsequent pixels is 375, and thedistance between one line and the next is given to be 1 byte.Consequently 8 entries are read for each “line”. A single “line”corresponds to the 8 bits to be loaded on the print head. The totalnumber of “lines” in the image is set to be 375. With at least 8 cachelines assigned to the Sequential Read Iterator, complete cache coherenceis maintained. Instead of counting the 8 bits, 8 Microcode steps countimplicitly.

The generation process first reads all the entries from the even dots,combining 8 entries into a single byte which is then output to the VLIWOutput FIFO. Once all 3000 even dots have been read, the 3000 odd dotsare read and processed. A software routine must update the address ofthe dots in the odd and even Sequential Read Iterators once per colorcomponent, which equates to 3 times per line. The two VLIW processesrequire all 8 ALUs and the VLIW Output FIFO. As long as the CPU is ableto update the registers as described in the two processes, the VLIWprocessor can generate the dithered image dots fast enough to keep upwith the printer.

Data Card Reader

FIG. 124, there is illustrated on form of card reader 500 which allowsfor the insertion of Artcards 9 for reading. FIG. 123 shows an explodedperspective of the reader of FIG. 124. Cardreader is interconnected to acomputer system and includes a CCD reading mechanism 35. The cardreaderincludes pinch rollers 506, 507 for pinching an inserted Artcard 9. Oneof the roller e.g. 506 is driven by an Artcard motor 37 for theadvancement of the card 9 between the two rollers 506 and 507 at auniformed speed. The Artcard 9 is passed over a series of LED lights 512which are encased within a clear plastic mould 514 having a semicircular cross section. The cross section focuses the light from theLEDs eg 512 onto the surface of the card 9 as it passes by the LEDs 512.From the surface it is reflected to a high resolution linear CCD 34which is constructed to a resolution of approximately 480 dpi. Thesurface of the Artcard 9 is encoded to the level of approximately 1600dpi hence, the linear CCD 34 supersamples the Artcard surface with anapproximately three times multiplier. The Artcard 9 is further driven ata speed such that the linear CCD 34 is able to supersample in thedirection of Artcard movement at a rate of approximately 4800 readingsper inch. The scanned Artcard CCD data is forwarded from the Artcardreader to ACP 31 for processing. A sensor 49, which can comprise a lightsensor acts to detect of the presence of the card 13.

The CCD reader includes a bottom substrate 516, a top substrate 514which comprises a transparent molded plastic. In between the twosubstrates is inserted the linear CCD array 34 which comprises a thinlong linear CCD array constructed by means of semi-conductormanufacturing processes.

Turning to FIG. 125, there is illustrated a side perspective view,partly in section, of an example construction of the CCD reader unit.The series of LEDs eg. 512 are operated to emit light when a card 9 ispassing across the surface of the CCD reader 34. The emitted light istransmitted through a portion of the top substrate 523. The substrateincludes a portion eg. 529 having a curved circumference so as to focuslight emitted from LED 512 to a point eg. 532 on the surface of the card9. The focused light is reflected from the point 532 towards the CCDarray 34. A series of microlenses eg. 534, shown in exaggerated form,are formed on the surface of the top substrate 523. The microlenses 523act to focus light received across the surface to the focused down to apoint 536 which corresponds to point on the surface of the CCD reader 34for sensing of light falling on the light sensing portion of the CCDarray 34.

A number of refinements of the above arrangement are possible. Forexample, the sensing devices on the linear CCD 34 may be staggered. Thecorresponding microlenses 34 can also be correspondingly formed as tofocus light into a staggered series of spots so as to correspond to thestaggered CCD sensors.

To assist reading, the data surface area of the Artcard 9 is modulatedwith a checkerboard pattern as previously discussed with reference toFIG. 38. Other forms of high frequency modulation may be possiblehowever.

It will be evident that an Artcard printer can be provided as for theprinting out of data on storage Artcard. Hence, the Artcard system canbe utilized as a general form of information distribution outside of theArtcam device. An Artcard printer can prints out Artcards on highquality print surfaces and multiple Artcards can be printed on samesheets and later separated. On a second surface of the Artcard 9 can beprinted information relating to the files etc. stored on the Artcard 9for subsequent storage.

Hence, the Artcard system allows for a simplified form of storage whichis suitable for use in place of other forms of storage such as CD ROMs,magnetic disks etc. The Artcards 9 can also be mass produced and therebyproduced in a substantially inexpensive form for redistribution.

Software Modules—Artcam Application 902

The Artcam Application implements the high-level functionality of theArtcam device. This normally involves capturing an image, applying anartistic effect to the image, and then printing the image. In acamera-oriented Artcam device, the image is captured via the CameraManager 903. In a printer-oriented Artcam device, the image is capturedvia the Network Manager 904, perhaps as the result of the image being“squirted” by another device.

Artistic effects are found within the unified file system managed by theFile Manager 905. An artistic effect consist of a script file and a setof resources. The script is interpreted and applied to the image via theImage Processing Manager 906. Scripts are normally shipped on ArtCardsknown as Artcards. By default the application uses the script containedon the currently mounted Artcard.

The image is printed via the Printer Manager 908.

When the Artcam device starts up, the bootstrap process starts thevarious manager processes before starting the application. This allowsthe application to immediately request services from the variousmanagers when it starts.

On initialization the application 902 registers itself as the handlerfor the events listed below. When it receives an event, it performs theaction described in the table.

User interface event Action Lock Focus Perform any automatic pre-capturesetup via the Camera Manager. This includes auto-focussing,auto-adjusting exposure, and charging the flash. This is normallyinitiated by the user pressing the Take button halfway. Take Capture animage via the Camera Manager. Self-Timer Capture an image in self-timedmode via the Camera Manager. Flash Mode Update the Camera Manager to usethe next flash mode. Update the Status Display to show the new flashmode. Print Print the current image via the Printer Manager. Apply anartistic effect to the image via the Image Processing Manager if thereis a current script. Update the remaining prints count on the StatusDisplay (see Print Roll Inserted below). Hold Apply an artistic effectto the current image via the Image Processing Manager if there is acurrent script, but don't print the image. Eject Eject the currentlyinserted ArtCards via the File Manager. ArtCards Print Roll Calculatethe number of prints remaining based on the Print Inserted Manager'sremaining media length and the Camera Manager's aspect ratio. Update theremaining prints count on the Status display. Print Roll Update theStatus Display to indicate there is no print roll Removed present.

Where the camera includes a display, the application also constructs agraphical user interface via the User Interface Manager 910 which allowsthe user to edit the current date and time, and other editable cameraparameters. The application saves all persistent parameters in flashmemory.

Real-Time Microkernel 911

The Real-Time Microkernel schedules processes preemptively on the basisof interrupts and process priority. It provides integrated inter-processcommunication and timer services, as these are closely tied to processscheduling. All other operating system functions are implemented outsidethe microkernel.

Camera Manager 903

The Camera Manager provides image capture services. It controls thecamera hardware embedded in the Artcam. It provides an abstract cameracontrol interface which allows camera parameters to be queried and set,and images captured. This abstract interface decouples the applicationfrom details of camera implementation. The Camera Manager utilizes thefollowing input/output parameters and commands:

output parameters domains focus range real, real zoom range real, realaperture range real, real shutter speed range real, real

input parameters domains focus real zoom real aperture real shutterspeed real aspect ratio classic, HDTV, panoramic focus control modemulti-point auto, single-point auto, manual exposure control mode auto,aperture priority, shutter priority, manual flash mode auto, auto withred-eye removal, fill, off view scene mode on, off

commands return value domains Lock Focus none Self-Timed Capture RawImage Capture Image Raw Image

The Camera Manager runs as an asynchronous event-driven process. Itcontains a set of linked state machines, one for each asynchronousoperation. These include auto focussing, charging the flash, countingdown the self-timer, and capturing the image. On initialization theCamera Manager sets the camera hardware to a known state. This includessetting a normal focal distance and retracting the zoom. The softwarestructure of the Camera Manager is illustrated in FIG. 128. The softwarecomponents are described in the following subsections:

Lock Focus 913

Lock Focus automatically adjusts focus and exposure for the currentscene, and enables the flash if necessary, depending on the focuscontrol mode, exposure control mode and flash mode. Lock Focus isnormally initiated in response to the user pressing the Take buttonhalfway. It is part of the normal image capture sequence, but may beseparated in time from the actual capture of the image, if the userholds the take button halfway depressed. This allows the user to do spotfocusing and spot metering.

Capture Image 914

Capture Image captures an image of the current scene. It lights ared-eye lamp if the flash mode includes red-eye removal, controls theshutter, triggers the flash if enabled, and senses the image through theimage sensor. It determines the orientation of the camera, and hence thecaptured image, so that the image can be properly oriented during laterimage processing. It also determines the presence of camera motionduring image capture, to trigger deblurring during later imageprocessing.

Self-Timed Capture 915

Self-Timed Capture captures an image of the current scene after countingdown a 20 s timer. It gives the user feedback during the countdown viathe self-timer LED. During the first 15 s it can light the LED. Duringthe last 5 s it flashes the LED.

View Scene 917

View Scene periodically senses the current scene through the imagesensor and displays it on the color LCD, giving the user an LCD-basedviewfinder.

Auto Focus 918

Auto Focus changes the focal length until selected regions of the imageare sufficiently sharp to signify that they are in focus. It assumes theregions are in focus if an image sharpness metric derived from specifiedregions of the image sensor is above a fixed threshold. It finds theoptimal focal length by performing a gradient descent on the derivativeof sharpness by focal length, changing direction and stepsize asrequired. If the focus control mode is multi point auto, then threeregions are used, arranged horizontally across the field of view. If thefocus control mode is single-point auto, then one region is used, in thecenter of the field of view. Auto Focus works within the available focallength range as indicated by the focus controller. In fixed-focusdevices it is therefore effectively disabled.

Auto Flash 919

Auto Flash determines if scene lighting is dim enough to require theflash. It assumes the lighting is dim enough if the scene lighting isbelow a fixed threshold. The scene lighting is obtained from thelighting sensor, which derives a lighting metric from a central regionof the image sensor. If the flash is required, then it charges theflash.

Auto Exposure 920

The combination of scene lighting, aperture, and shutter speed determinethe exposure of the captured image. The desired exposure is a fixedvalue. If the exposure control mode is auto, Auto Exposure determines acombined aperture and shutter speed which yields the desired exposurefor the given scene lighting. If the exposure control mode is aperturepriority, Auto Exposure determines a shutter speed which yields thedesired exposure for the given scene lighting and current aperture. Ifthe exposure control mode is shutter priority, Auto Exposure determinesan aperture which yields the desired exposure for the given scenelighting and current shutter speed. The scene lighting is obtained fromthe lighting sensor, which derives a lighting metric from a centralregion of the image sensor.

Auto Exposure works within the available aperture range and shutterspeed range as indicated by the aperture controller and shutter speedcontroller. The shutter speed controller and shutter controller hide theabsence of a mechanical shutter in most Artcam devices.

If the flash is enabled, either manually or by Auto Flash, then theeffective shutter speed is the duration of the flash, which is typicallyin the range 1/1000 s to 1/10000 s.

Image Processing Manager 906 (FIG. 127

The Image Processing Manager provides image processing and artisticeffects services. It utilises the VLIW Vector Processor embedded in theArtcam to perform high-speed image processing. The Image ProcessingManager contains an interpreter for scripts written in the Vark imageprocessing language. An artistic effect therefore consists of a Varkscript file and related resources such as fonts, clip images etc. Thesoftware structure of the Image Processing Manager is illustrated inmore detail in FIG. 129 and include the following modules:

Convert and Enhance Image 921

The Image Processing Manager performs image processing in thedevice-independent CIE LAB color space, at a resolution which suits thereproduction capabilities of the Artcam printer hardware. The capturedimage is first enhanced by filtering out noise. It is optionallyprocessed to remove motion-induced blur. The image is then convertedfrom its device-dependent RGB color space to the CIE LAB color space. Itis also rotated to undo the effect of any camera rotation at the time ofimage capture, and scaled to the working image resolution. The image isfurther enhanced by scaling its dynamic range to the available dynamicrange.

Detect Faces 923

Faces are detected in the captured image based on hue and local featureanalysis. The list of detected face regions is used by the Vark scriptfor applying face-specific effects such as warping and positioningspeech balloons.

Vark Image Processing Language Interpreter 924

Vark consists of a general-purpose programming language with a rich setof image processing extensions. It provides a range of primitive datatypes (integer, real, boolean, character), a range of aggregate datatypes for constructing more complex types (array, string, record), arich set of arithmetic and relational operators, conditional anditerative control flow (if-then-else, while-do), and recursive functionsand procedures. It also provides a range of image-processing data types(image, clip image, matte, color, color lookup table, palette, dithermatrix, convolution kernel, etc.), graphics data types (font, text,path), a set of image-processing functions (color transformations,compositing, filtering, spatial transformations and warping,illumination, text setting and rendering), and a set of higher-levelartistic functions (tiling, painting and stroking).

A Vark program is portable in two senses. Because it is interpreted, itis independent of the CPU and image processing engines of its host.Because it uses a device-independent model space and adevice-independent color space, it is independent of the input colorcharacteristics and resolution of the host input device, and the outputcolor characteristics and resolution of the host output device.

The Vark Interpreter 924 parses the source statements which make up theVark script and produces a parse tree which represents the semantics ofthe script. Nodes in the parse tree correspond to statements,expressions, sub-expressions, variables and constants in the program.The root node corresponds to the main procedure statement list.

The interpreter executes the program by executing the root statement inthe parse tree. Each node of the parse tree asks its children toevaluate or execute themselves appropriately. An if statement node, forexample, has three children—a condition expression node, a thenstatement node, and an else statement node. The if statement asks thecondition expression node to evaluate itself, and depending on theboolean value returned asks the then statement or the else statement toexecute itself. It knows nothing about the actual condition expressionor the actual statements.

While operations on most data types are executed during execution of theparse tree, operations on image data types are deferred until afterexecution of the parse tree. This allows imaging operations to beoptimized so that only those intermediate pixels which contribute to thefinal image are computed. It also allows the final image to be computedin multiple passes by spatial subdivision, to reduce the amount ofmemory required.

During execution of the parse tree, each imaging function simply returnsan imaging graph—a graph whose nodes are imaging operators and whoseleaves are images—constructed with its corresponding imaging operator asthe root and its image parameters as the root's children. The imageparameters are of course themselves image graphs. Thus each successiveimaging function returns a deeper imaging graph.

After execution of the parse tree, an imaging graph is obtained whichcorresponds to the final image. This imaging graph is then executed in adepth-first manner (like any expression tree), with the following twooptimizations: (1) only those pixels which contribute to the final imageare computed at a given node, and (2) the children of a node areexecuted in the order which minimizes the amount of memory required. Theimaging operators in the imaging graph are executed in the optimizedorder to produce the final image. Compute-intensive imaging operatorsare accelerated using the VLIW Processor embedded in the Artcam device.If the amount of memory required to execute the imaging graph exceedsavailable memory, then the final image region is subdivided until therequired memory no longer exceeds available memory.

For a well-constructed Vark program the first optimization is unlikelyto provide much benefit per se. However, if the final image region issubdivided, then the optimization is likely to provide considerablebenefit. It is precisely this optimization, then, that allowssubdivision to be used as an effective technique for reducing memoryrequirements. One of the consequences of deferred execution of imagingoperations is that program control flow cannot depend on image content,since image content is not known during parse tree execution. Inpractice this is not a severe restriction, but nonetheless must be bornein mind during language design.

The notion of deferred execution (or lazy evaluation) of imagingoperations is described by Guibas and Stolfi (Guibas, L. J., and J.Stolfi, “A Language for Bitmap Manipulation”, ACM Transactions onGraphics, Vol. 1, No. 3, July 1982, pp. 191-214). They likewiseconstruct an imaging graph during the execution of a program, and duringsubsequent graph evaluation propagate the result region backwards toavoid computing pixels which do not contribute to the final image.Shantzis additionally propagates regions of available pixels forwardsduring imaging graph evaluation (Shantzis, M. A., “A Model for Efficientand Flexible Image Computing”, Computer Graphics Proceedings, AnnualConference Series, 1994, pp. 147-154). The Vark Interpreter uses themore sophisticated multi-pass bi-directional region propagation schemedescribed by Cameron (Cameron, S., “Efficient Bounds in ConstructiveSolid Geometry”, IEEE Computer Graphics & Applications, Vol. 11, No. 3,May 1991, pp. 68-74). The optimization of execution order to minimisememory usage is due to Shantzis, but is based on standard compilertheory (Aho, A. V., R. Sethi, and J. D. Ullman, “Generating Code fromDAGs”, in Compilers: Principles, Techniques, and Tools, Addison-Wesley,1986, pp. 557-567,). The Vark Interpreter uses a more sophisticatedscheme than Shantzis, however, to support variable-sized image buffers.The subdivision of the result region in conjunction with regionpropagation to reduce memory usage is also due to Shantzis.

Printer Manager 908 (FIG. 127)

The Printer Manager provides image printing services. It controls theInk Jet printer hardware embedded in the Artcam. It provides an abstractprinter control interface which allows printer parameters to be queriedand set, and images printed. This abstract interface decouples theapplication from details of printer implementation and includes thefollowing variables:

output parameters domains media is present bool media has fixed pagesize bool media width real remaining media length real fixed page sizereal, real

input parameters domains page size real, real

commands return value domains Print Image none

output events invalid media media exhausted media inserted media removed

The Printer Manager runs as an asynchronous event-driven process. Itcontains a set of linked state machines, one for each asynchronousoperation. These include printing the image and auto mounting the printroll. The software structure of the Printer Manager is illustrated inFIG. 130. The software components are described in the followingdescription:

Print Image 930

Print Image prints the supplied image. It uses the VLIW Processor toprepare the image for printing. This includes converting the image colorspace to device-specific CMY and producing half-toned bi-level data inthe format expected by the print head.

Between prints, the paper is retracted to the lip of the print roll toallow print roll removal, and the nozzles can be capped to prevent inkleakage and drying. Before actual printing starts, therefore, thenozzles are uncapped and cleared, and the paper is advanced to the printhead. Printing itself consists of transferring line data from the VLIWprocessor, printing the line data, and advancing the paper, until theimage is completely printed. After printing is complete, the paper iscut with the guillotine and retracted to the print roll, and the nozzlesare capped. The remaining media length is then updated in the printroll.

Auto Mount Print Roll 131

Auto Mount Print Roll responds to the insertion and removal of the printroll. It generates print roll insertion and removal events which arehandled by the application and used to update the status display. Theprint roll is authenticated according to a protocol between theauthentication chip embedded in the print roll and the authenticationchip embedded in Artcam. If the print roll fails authentication then itis rejected. Various information is extracted from the print roll. Paperand ink characteristics are used during the printing process. Theremaining media length and the fixed page size of the media, if any, arepublished by the Print Manager and are used by the application.

User Interface Manager 910 (FIG. 127)

The User Interface Manager is illustrated in more detail if FIG. 131 andprovides user interface management services. It consists of a PhysicalUser Interface Manager 911, which controls status display and inputhardware, and a Graphical User Interface Manager 912, which manages avirtual graphical user interface on the color display. The UserInterface Manager translates virtual and physical inputs into events.Each event is placed in the event queue of the process registered forthat event.

File Manager 905 (FIG. 128)

The File Manager provides file management services. It provides aunified hierarchical file system within which the file systems of allmounted volumes appear. The primary removable storage medium used in theArtcam is the ArtCards. A ArtCards is printed at high resolution withblocks of bi-level dots which directly representserror-tolerantReed-Solomon-encoded binary data. The block structure supports appendand append-rewrite in suitable read-write ArtCards devices (notinitially used in Artcam). At a higher level a ArtCards can contain anextended append-rewriteable ISO9660 CD-ROM file system. The softwarestructure of the File Manager, and the ArtCards Device Controller inparticular, can be as illustrated in FIG. 132.

Network Manager 904 (FIG. 128)

The Network Manager provides “appliance” networking services acrossvarious interfaces including infra-red (IrDA) and universal serial bus(USB). This allows the Artcam to share captured images, and receiveimages for printing.

Clock Manager 907 (FIG. 128)

The Clock Manager provides date and time-of-day clock services. Itutilises the battery-backed real-time clock embedded in the Artcam, andcontrols it to the extent that it automatically adjusts for clock drift,based on auto-calibration carried out when the user sets the time.

Power Management

When the system is idle it enters a quiescent power state during whichonly periodic scanning for input events occurs. Input events include thepress of a button or the insertion of a ArtCards. As soon as an inputevent is detected the Artcam device re-enters an active power state. Thesystem then handles the input event in the usual way.

Even when the system is in an active power state, the hardwareassociated with individual modules is typically in a quiescent powerstate. This reduces overall power consumption, and allows particularlydraining hardware components such as the printer's paper cuttingguillotine to monopolise the power source when they are operating. Acamera-oriented Artcam device is, by default, in image capture mode.This means that the camera is active, and other modules, such as theprinter, are quiescent. This means that when non-camera functions areinitiated, the application must explicitly suspend the camera module.Other modules naturally suspend themselves when they become idle.

1. A portable imaging device comprising: an image sensor; a colordisplay for displaying an image sensed by the CMOS image sensor; anorientation sensor for sensing the device orientation; and, a centralprocessor having an image sensor interface for receiving data from theimage sensor and an output from the orientation sensor, multipleprocessing units configured for simultaneously processing the data, andan image display interface for sending processed data to the colordisplay; wherein, the central processor is integrated onto a singlechip.
 2. The portable imaging device according to claim 1 furthercomprising user input buttons wherein the central processor furthercomprises a parallel interface integrated onto the single chipconfigured for receiving signals from the buttons and the orientationsensor in parallel.
 3. The portable imaging device according to claim 2wherein the central processor further comprises an input FIFO (first in,first out) for receiving data from the image sensor interface and inputsfrom the parallel interface, and inputting the data and the parallelinterface inputs to the multiple processing units, and an output FIFOfor receiving processed data.
 4. The portable imaging device accordingto claim 3 wherein the central processor has four of the processingunits and further comprises a crossbar switch for connecting each of thefour processing units.
 5. The portable imaging device according to claim4 wherein the central processor further comprises a central processingunit and a data bus connecting the central processing unit to the inputFIFO and the output FIFO, the central processing unit providing aprocessing core to operatively control the four processing units.
 6. Theportable imaging device according to claim 5 wherein the centralprocessor further comprises a data cache to store the processed datauntil required by the central processor unit.
 7. The portable imagingdevice according to claim 6 further comprising a printhead wherein thecentral processor has a printhead interface integrated on the chip andthe four processing units are configured to perform one or moreprocessing tasks selected from: rotating the data from the image sensorfor printing by the printhead; color converting the data for printing bythe printhead; and, dithering the data for printing by the printhead. 8.The portable imaging device according to claim 7 wherein the displayinterface is connected to the data cache for reading the processed dataand transmitting the processed data to the color display.
 9. Theportable imaging device according to claim 8 wherein each of theprocessing units have at least one address generator for the processeddata sent to the data cache.
 10. The portable imaging device accordingto claim 9 wherein the four processing units have RAM (random accessmemory) for microcode written by the central processor unit tooperatively control that processing unit.
 11. The portable imagingdevice according to claim 10 wherein the central processor has akeyboard interface for user input of instructions to the centralprocessor unit to rewrites the microcode in the RAM within each of theprocessing units.
 12. The portable imaging device according to claim 11one of the plurality of interfaces is a scanner interface for receivingscanned image data of an image encoding image processing instructions ina machine readable form, the scanner interface being configured todecode the scanned image data and send the image processing instructionsto the input FIFO.
 13. The portable imaging device according to claim 12further comprising a print media roll on which the printhead prints, theprint media roll being removable and replaceable, and one of theplurality of interfaces is an authentication chip interface forinterrogating an authentication chip in the media roll forauthentication information.
 14. The portable imaging device according toclaim 1 further comprising a USB port for communication with an externaldevice, wherein the central processor further comprises a USB interface.15. The portable imaging device according to claim 1 further comprisinga 3 Volt battery.